1
0
SecurityAndStuff 2 жил өмнө
parent
commit
a0e150791b

+ 9 - 1
gramjs/network/MTProtoSender.ts

@@ -277,7 +277,15 @@ export class MTProtoSender {
      * all pending requests, and closes the send and receive loops.
      */
     async disconnect() {
-        await this._disconnect();
+        const release = await this._connectMutex.acquire();
+        try {
+            await this._disconnect();
+        } catch (e: any) {
+            this._log.error(e);
+        }
+        finally {
+            release();
+        }
     }
 
     /**