Explorar o código

Allow delete this in onclose callback for #496

ithewei hai 1 ano
pai
achega
90e3b2fa13
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      evpp/TcpClient.h

+ 2 - 2
evpp/TcpClient.h

@@ -154,11 +154,11 @@ public:
             }
         };
         channel->onclose = [this]() {
+            bool reconnect = reconn_setting != NULL;
             if (onConnection) {
                 onConnection(channel);
             }
-            // reconnect
-            if (reconn_setting) {
+            if (reconnect) {
                 startReconnect();
             }
         };