244 @param debuggerId ID of the debugger the socket belongs to |
245 @param debuggerId ID of the debugger the socket belongs to |
245 @type str |
246 @type str |
246 @param sock reference to the socket |
247 @param sock reference to the socket |
247 @type socket.socket |
248 @type socket.socket |
248 """ |
249 """ |
249 with contextlib.suppress(KeyError): |
250 with contextlib.suppress(KeyError, OSError): |
250 # Socket might have been unregister automatically (e.g. due to a crash of |
251 # Socket might have been unregister automatically (e.g. due to a crash of |
251 # the script being debugged). |
252 # the script being debugged). |
252 self._server.getSelector().unregister(sock) |
253 self._server.getSelector().unregister(sock) |
253 sock.shutdown(socket.SHUT_RDWR) |
254 sock.shutdown(socket.SHUT_RDWR) |
254 sock.close() |
255 sock.close() |
255 |
256 |
256 if debuggerId: |
257 if debuggerId: |
257 self._server.sendJson( |
258 self._server.sendJson( |
258 category=EricRequestCategory.Debugger, |
259 category=EricRequestCategory.Debugger, |
259 reply="DebugClientDisconnected", |
260 reply="DebugClientDisconnected", |