From 5c2c3b5e98df107db58880cd994a619cd18c4469 Mon Sep 17 00:00:00 2001 From: link Date: Mon, 20 Mar 2023 17:02:42 +0800 Subject: [PATCH] Update file count (#965) --- route/v1/file.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/route/v1/file.go b/route/v1/file.go index 72707f7..838fa81 100644 --- a/route/v1/file.go +++ b/route/v1/file.go @@ -985,6 +985,7 @@ func init() { func (c *Client) writePump() { defer func() { c.handler.unregister <- c + c.conn.Close() }() for { @@ -1011,6 +1012,7 @@ func (c *Client) readPump() { if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) { log.Printf("error: %v", err) } + c.handler.broadcast <- []byte(`{"type":"peer-left","peerId":"` + c.ID + `"}`) break } // 要的话,推给广播中心,广播中心再推给每个用户