Skip to content
This repository was archived by the owner on Aug 28, 2020. It is now read-only.

Commit 35fb919

Browse files
committed
return early if new connection is not valid
1 parent d399ff7 commit 35fb919

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pugdebug/server.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ def __connect(self):
6666

6767
if sock is not None:
6868
connection = PugdebugServerConnection(sock)
69-
connection.init_connection()
69+
is_valid = connection.init_connection()
7070

71-
if connection.is_valid:
71+
if is_valid:
7272
self.server_connected_signal.emit(connection)
7373
except socket.timeout:
7474
pass
@@ -134,7 +134,7 @@ def init_connection(self):
134134

135135
# See if the init message from xdebug is meant for us
136136
if idekey != '' and init_message['idekey'] != idekey:
137-
self.is_valid = False
137+
return False
138138

139139
command = 'feature_set -i %d -n max_depth -v 9' % (
140140
self.__get_transaction_id()
@@ -151,9 +151,10 @@ def init_connection(self):
151151
)
152152
response = self.__send_command(command)
153153

154-
self.is_valid = True
155154
self.init_message = init_message
156155

156+
return True
157+
157158
def run(self):
158159
self.mutex.lock()
159160

0 commit comments

Comments
 (0)