fix
This commit is contained in:
parent
636bc0aee7
commit
f609fa364d
|
@ -142,7 +142,7 @@ func (l *DataTransferLogic) checkAuth(svcCtx *svc.ServiceContext, r *http.Reques
|
||||||
|
|
||||||
// 心跳
|
// 心跳
|
||||||
func (w *wsConnectItem) heartbeat() {
|
func (w *wsConnectItem) heartbeat() {
|
||||||
tick := time.Tick(time.Second * 10)
|
tick := time.Tick(time.Second * 2)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-w.closeChan:
|
case <-w.closeChan:
|
||||||
|
@ -166,6 +166,7 @@ func (w *wsConnectItem) close() {
|
||||||
defer w.mutex.Unlock()
|
defer w.mutex.Unlock()
|
||||||
logx.Info("websocket:", w.flag, " is closing...")
|
logx.Info("websocket:", w.flag, " is closing...")
|
||||||
//发送关闭信息
|
//发送关闭信息
|
||||||
|
_ = w.conn.SetWriteDeadline(time.Now().Add(time.Second))
|
||||||
_ = w.conn.WriteMessage(websocket.CloseMessage, nil)
|
_ = w.conn.WriteMessage(websocket.CloseMessage, nil)
|
||||||
w.conn.Close()
|
w.conn.Close()
|
||||||
mapConnPool.Delete(w.flag)
|
mapConnPool.Delete(w.flag)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user