Skip to content

Commit 3d7b01e

Browse files
Fixed UDP data channel receive operations
1 parent 8485678 commit 3d7b01e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/sttp/transport/datasubscriber.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def subscribe(self) -> Optional[Exception]:
410410

411411
try:
412412
self._datachannel_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
413-
self._datachannel_socket.bind(("127.0.0.1", udpport))
413+
self._datachannel_socket.bind(("", udpport))
414414
except Exception as ex:
415415
return RuntimeError(f"failed to open UDP socket for port {udpport}:{ex}")
416416

@@ -644,8 +644,8 @@ def _read_payloadheader(self):
644644
# subscription, data packets get handled from this thread.
645645
def _run_datachannel_responsethread(self):
646646
reader = StreamEncoder(
647-
(lambda length: self._datachannel_socket.recvfrom(length)),
648-
(lambda buffer: self._datachannel_socket.sendto(buffer)))
647+
(lambda length: self._datachannel_socket.recvfrom(length)[0]),
648+
(lambda _: ...))
649649

650650
buffer = bytearray(MAXPACKET_SIZE)
651651

@@ -657,7 +657,7 @@ def _run_datachannel_responsethread(self):
657657
self._total_datachannel_bytesreceived += length
658658

659659
# Process response
660-
self._process_serverresponse(bytes(self._readbuffer[:length]))
660+
self._process_serverresponse(bytes(buffer[:length]))
661661
except Exception:
662662
# Read error, connection may have been closed by peer; terminate connection
663663
self._dispatch_connectionterminated()

0 commit comments

Comments
 (0)