@Override public void run() { while (myShouldAccept) { try { final ServerSocket serverSocketCopy = myServerSocket; if (serverSocketCopy == null) { break; } Socket socket = serverSocketCopy.accept(); try { final ServerSocket serverSocket = createServerSocket(); final RemoteDebugger debugger = new RemoteDebugger( myMultiProcessDebugger.myDebugProcess, serverSocket, myMultiProcessDebugger.myTimeoutInMillis); addCloseListener(debugger); sendDebuggerPort(socket, serverSocket, myMultiProcessDebugger.myDebugProcess); socket.close(); debugger.waitForConnect(); debugger.handshake(); myMultiProcessDebugger.addDebugger(debugger); myMultiProcessDebugger.myDebugProcess.init(); debugger.run(); } catch (Exception e) { LOG.warn(e); } finally { if (!socket.isClosed()) { socket.close(); } } } catch (Exception ignore) { if (myServerSocket == null) { myShouldAccept = false; } } } }
@Override public String handshake() throws PyDebuggerException { return myMainDebugger.handshake(); }