Skip to content

Commit

Permalink
Fix Python client TCPTransports not being able to close (#390)
Browse files Browse the repository at this point in the history
* Fix Python client TCPTransports not being able to close

* Shutdown socket before close

* Replace unnecessary private import

---------

Co-authored-by: Thom van der Steenhoven <[email protected]>
  • Loading branch information
Thom747 and Thom747 authored Feb 9, 2024
1 parent 7b7c55f commit a8a7a0d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion erpc_python/erpc/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import struct
import socket
import threading
from socket import SHUT_RDWR

from .crc16 import Crc16
from .client import RequestError
import time
Expand Down Expand Up @@ -166,7 +168,9 @@ def _serve(self):
self._serverSockEventStart.set()

def close(self):
self._serverSockEventStart.clear()
if self._isServer:
self._serverSockEventStart.clear()
self._sock.shutdown(SHUT_RDWR)
self._sock.close()
self._sock = None

Expand Down

0 comments on commit a8a7a0d

Please sign in to comment.