wshandler에서 직접 state를 쓰는 코드 제거
This commit is contained in:
@ -258,15 +258,6 @@ func (ws *WebsocketHandler) RegisterHandlers(serveMux *http.ServeMux, prefix str
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ws *WebsocketHandler) GetState(accid primitive.ObjectID) string {
|
||||
state, _ := ws.redisSync.Get(context.Background(), accid.Hex()).Result()
|
||||
return state
|
||||
}
|
||||
|
||||
func (ws *WebsocketHandler) SetState(accid primitive.ObjectID, state string) {
|
||||
ws.redisSync.SetArgs(context.Background(), accid.Hex(), state, redis.SetArgs{Mode: "XX"}).Result()
|
||||
}
|
||||
|
||||
func (ws *WebsocketHandler) SendUpstreamMessage(msg *UpstreamMessage) {
|
||||
ws.localDeliveryChan <- msg
|
||||
}
|
||||
@ -547,7 +538,6 @@ func upgrade_core(ws *WebsocketHandler, conn *websocket.Conn, accid primitive.Ob
|
||||
|
||||
ws.connWaitGroup.Add(1)
|
||||
go func(c *wsconn, accid primitive.ObjectID, deliveryChan chan<- any) {
|
||||
ws.redisSync.Set(context.Background(), accid.Hex(), "online", 0)
|
||||
for {
|
||||
messageType, r, err := c.NextReader()
|
||||
if err != nil {
|
||||
@ -571,8 +561,6 @@ func upgrade_core(ws *WebsocketHandler, conn *websocket.Conn, accid primitive.Ob
|
||||
f()
|
||||
}
|
||||
}
|
||||
|
||||
ws.redisSync.Del(context.Background(), accid.Hex())
|
||||
ws.connWaitGroup.Done()
|
||||
|
||||
c.Conn = nil
|
||||
|
||||
Reference in New Issue
Block a user