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