瀏覽代碼

fixing deadlock

reid 2 年之前
父節點
當前提交
90ba4d4316
共有 2 個文件被更改,包括 2 次插入1 次删除
  1. 1 1
      auth/auth.go
  2. 1 0
      broadcast/broadcast.go

+ 1 - 1
auth/auth.go

@@ -39,8 +39,8 @@ var (
 // check if websocket session is in the auth map
 func WsIsAuthenticated(conn *websocket.Conn) bool {
 	AuthenticatedClients.Lock()
+	defer AuthenticatedClients.Unlock()
 	_, exists := AuthenticatedClients.Conns[conn]
-	AuthenticatedClients.Unlock()
 	return exists
 }
 

+ 1 - 0
broadcast/broadcast.go

@@ -184,6 +184,7 @@ func constructPierInfo(piers []string) (map[string]structs.Urbit, error) {
 		// and insert the struct into the map we will use as input for the broadcast struct
 		updates[pier] = urbit
 	}
+	config.Logger.Info("Pier info constructed")
 	return updates, nil
 }