286 connection is allowed. |
286 connection is allowed. |
287 """ |
287 """ |
288 self.__selector.unregister(self.__socket) |
288 self.__selector.unregister(self.__socket) |
289 self.__socket.shutdown(socket.SHUT_RDWR) |
289 self.__socket.shutdown(socket.SHUT_RDWR) |
290 self.__socket.close() |
290 self.__socket.close() |
|
291 self.__socket = None |
291 |
292 |
292 def __shutdown(self): |
293 def __shutdown(self): |
293 """ |
294 """ |
294 Private method to shut down the server. |
295 Private method to shut down the server. |
295 """ |
296 """ |
296 self.__closeIdeConnection() |
297 self.__closeIdeConnection(shutdown=True) |
297 |
298 |
298 print("Stop listening for 'eric-ide' connections.") |
299 print("Stop listening for 'eric-ide' connections.") |
299 self.__socket.shutdown(socket.SHUT_RDWR) |
300 if self.__socket is not None: |
300 self.__socket.close() |
301 self.__socket.shutdown(socket.SHUT_RDWR) |
|
302 self.__socket.close() |
301 |
303 |
302 self.__selector.close() |
304 self.__selector.close() |
303 |
305 |
304 def __acceptIdeConnection(self, sock): |
306 def __acceptIdeConnection(self, sock): |
305 """ |
307 """ |
324 print( |
326 print( |
325 f"'eric-ide' connection from {address[0]}, port {address[1]} rejected" |
327 f"'eric-ide' connection from {address[0]}, port {address[1]} rejected" |
326 ) |
328 ) |
327 connection.close() |
329 connection.close() |
328 |
330 |
329 def __closeIdeConnection(self): |
331 def __closeIdeConnection(self, shutdown=False): |
330 """ |
332 """ |
331 Private method to close the connection to an eric-ide. |
333 Private method to close the connection to an eric-ide. |
332 """ |
334 """ |
333 if self.__connection is not None: |
335 if self.__connection is not None: |
334 self.__selector.unregister(self.__connection) |
336 self.__selector.unregister(self.__connection) |
343 print("'eric-ide' connection gone.") |
345 print("'eric-ide' connection gone.") |
344 self.__connection = None |
346 self.__connection = None |
345 |
347 |
346 self.__debuggerRequestHandler.shutdownClients() |
348 self.__debuggerRequestHandler.shutdownClients() |
347 |
349 |
348 self.__initializeIdeSocket() |
350 if not shutdown: |
|
351 self.__initializeIdeSocket() |
349 |
352 |
350 def __serviceIdeConnection(self, key): |
353 def __serviceIdeConnection(self, key): |
351 """ |
354 """ |
352 Private method to service the eric-ide connection. |
355 Private method to service the eric-ide connection. |
353 |
356 |