@@ -207,16 +207,24 @@ def __connect_server(self):
207207 socket_server .bind ((host , port_number ))
208208 socket_server .listen (5 )
209209
210- while self .wait_for_accept :
211- try :
212- self .sock , address = socket_server .accept ()
213- self .sock .settimeout (None )
214- self .wait_for_accept = False
215- except socket .timeout :
216- pass
217-
218- self .is_waiting = False
219- response = self .__init_connection ()
210+ response = False
211+
212+ while response is False :
213+ while self .wait_for_accept :
214+ try :
215+ self .sock , address = socket_server .accept ()
216+ self .sock .settimeout (None )
217+ self .wait_for_accept = False
218+ except socket .timeout :
219+ pass
220+ self .is_waiting = False
221+ response = self .__init_connection ()
222+
223+ if response is False :
224+ self .sock .close ()
225+ self .wait_for_accept = True
226+ self .is_waiting = True
227+
220228 except OSError :
221229 print (OSError .strerror ())
222230 print ("Socket bind failed" )
@@ -229,10 +237,16 @@ def __init_connection(self):
229237 if self .sock is None :
230238 return
231239
240+ idekey = get_setting ('debugger/idekey' )
241+
232242 response = self .__receive_message ()
233243
234244 init_message = self .parser .parse_init_message (response )
235245
246+ # See if the init message from xdebug is meant for us
247+ if idekey != '' and init_message ['idekey' ] != idekey :
248+ return False
249+
236250 command = 'feature_set -i %d -n max_depth -v 9' % (
237251 self .__get_transaction_id ()
238252 )
0 commit comments