Skip to content

Commit a8a7a0d

Browse files
authored
Fix Python client TCPTransports not being able to close (#390)
* 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]>
1 parent 7b7c55f commit a8a7a0d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

erpc_python/erpc/transport.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import struct
1111
import socket
1212
import threading
13+
from socket import SHUT_RDWR
14+
1315
from .crc16 import Crc16
1416
from .client import RequestError
1517
import time
@@ -166,7 +168,9 @@ def _serve(self):
166168
self._serverSockEventStart.set()
167169

168170
def close(self):
169-
self._serverSockEventStart.clear()
171+
if self._isServer:
172+
self._serverSockEventStart.clear()
173+
self._sock.shutdown(SHUT_RDWR)
170174
self._sock.close()
171175
self._sock = None
172176

0 commit comments

Comments
 (0)