MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / close_connection

Method close_connection

relay/instance_registry.py:170–184  ·  view source on GitHub ↗

Close the connection to this instance

(self)

Source from the content-addressed store, hash-verified

168 logger.info(f"Flushed command queue for {self.instance_id}")
169
170 async def close_connection(self) -> None:
171 """Close the connection to this instance"""
172 # Flush queue before closing
173 if self.command_queue:
174 self.flush_queue("INSTANCE_DISCONNECTED", "Instance disconnected")
175
176 if self.writer and not self.writer.is_closing():
177 self.writer.close()
178 try:
179 await self.writer.wait_closed()
180 except Exception:
181 pass
182 self.writer = None
183 self.reader = None
184 self.set_status(InstanceStatus.DISCONNECTED)
185
186
187class InstanceRegistry:

Callers 5

registerMethod · 0.80
unregisterMethod · 0.80
close_allMethod · 0.80

Calls 2

flush_queueMethod · 0.95
set_statusMethod · 0.95

Tested by 1