MCPcopy Create free account
hub / github.com/microsoft/debugpy / disconnect

Method disconnect

src/debugpy/adapter/servers.py:366–391  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

364 self.connection.server = None
365
366 def disconnect(self):
367 if self.connection.process_replaced:
368 # Wait for the replacement server to connect to the adapter, and to report
369 # itself to the client for this session if there is one.
370 log.info("{0} is waiting for replacement subprocess.", self)
371 session = self.session
372 if not session.client or not session.client.is_connected:
373 wait_for_connection(
374 session, lambda conn: conn.pid == self.pid, timeout=60
375 )
376 else:
377 self.wait_for(
378 lambda: (
379 not session.client
380 or not session.client.is_connected
381 or any(
382 conn.pid == self.pid
383 for conn in session.client.known_subprocesses
384 )
385 ),
386 timeout=60,
387 )
388 with _lock:
389 _connections.remove(self.connection)
390 _connections_changed.set()
391 super().disconnect()
392
393
394def serve(host="127.0.0.1", port=0):

Callers 1

disconnectMethod · 0.45

Calls 4

wait_for_connectionFunction · 0.85
infoMethod · 0.80
wait_forMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected