Close the socket and context, and remove the IPC files.
(self)
| 373 | llm_logger.warning(f"Failed to remove IPC file {name} - {e}") |
| 374 | |
| 375 | def close(self): |
| 376 | """ |
| 377 | Close the socket and context, and remove the IPC files. |
| 378 | """ |
| 379 | if not self.running: |
| 380 | return |
| 381 | |
| 382 | self.running = False |
| 383 | llm_logger.info("ZMQ server is closing connection...") |
| 384 | try: |
| 385 | if self.socket is not None and not self.socket.closed: |
| 386 | self.socket.close() |
| 387 | if not self.context.closed: |
| 388 | self.context.term() |
| 389 | self._clear_ipc(self.file_name) |
| 390 | except Exception as e: |
| 391 | llm_logger.warning(f"ZMQ server failed to close connection - {e}") |
| 392 | return |
| 393 | |
| 394 | |
| 395 | class ZmqTcpServer(ZmqServerBase): |