Просмотр исходного кода

merge AriaNg commit(https://github.com/mayswind/AriaNg/commit/207cbd1d90e2e88e50c6110d3237b2e80b54a690)

MaysWind 3 лет назад
Родитель
Сommit
c0f416990f
1 измененных файлов с 23 добавлено и 0 удалено
  1. 23 0
      app/scripts/services/aria2WebSocketRpcService.js

+ 23 - 0
app/scripts/services/aria2WebSocketRpcService.js

@@ -142,6 +142,29 @@
                 return;
             }
 
+            for (var uniqueId in sendIdStates) {
+                if (!sendIdStates.hasOwnProperty(uniqueId)) {
+                    continue;
+                }
+
+                var state = sendIdStates[uniqueId];
+
+                if (!state) {
+                    delete sendIdStates[uniqueId];
+                    continue;
+                }
+
+                state.deferred.reject({
+                    success: false,
+                    context: state.context
+                });
+
+                ariaNgLogService.debug('[aria2WebSocketRpcService.reconnect] reject old request', state.context);
+                state.context.errorCallback(state.context.id, { message: 'Cannot connect to aria2!' });
+
+                delete sendIdStates[uniqueId];
+            }
+
             if (context.connectionReconnectingCallback) {
                 context.connectionReconnectingCallback({
                     rpcUrl: rpcUrl