1
This commit is contained in:
parent
fed40e2aa8
commit
083781737a
|
@ -300,7 +300,7 @@ func (w *wsConnectItem) readLoop() {
|
|||
select {
|
||||
case <-w.closeChan: //如果关闭了
|
||||
return
|
||||
default:
|
||||
default: //收取消息
|
||||
msgType, data, err := w.conn.ReadMessage()
|
||||
if err != nil {
|
||||
logx.Error("接受信息错误:", err)
|
||||
|
@ -310,8 +310,12 @@ func (w *wsConnectItem) readLoop() {
|
|||
}
|
||||
//ping的消息不处理
|
||||
if msgType != websocket.PingMessage {
|
||||
//消息传入缓冲通道
|
||||
w.inChan <- data
|
||||
select {
|
||||
case w.inChan <- data: //消息传入缓冲通道
|
||||
continue
|
||||
case <-time.After(time.Second * 3): //3秒放不进去就丢弃
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user