diff options
author | Trond Abusdal <trond.abusdal@gmail.com> | 2015-11-09 00:22:05 +0100 |
---|---|---|
committer | Trond Abusdal <trond.abusdal@gmail.com> | 2015-11-09 00:22:05 +0100 |
commit | f809cd44eabbf3f0a263cb625b60adeb8f6802f0 (patch) | |
tree | 8ac2866b190dc8abb2708aa04b4130e9ac5ff486 /drivers/unix | |
parent | 3fcfdfec0ac5175f55527b3ec95d14d48bf29dd2 (diff) |
Fixed PacketPeerUDP getting wrongly closed due to recvfrom using rb.data_left instead of rb.space_left.
Diffstat (limited to 'drivers/unix')
-rw-r--r-- | drivers/unix/packet_peer_udp_posix.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/unix/packet_peer_udp_posix.cpp b/drivers/unix/packet_peer_udp_posix.cpp index 94b4c35923..fd94f0e3bf 100644 --- a/drivers/unix/packet_peer_udp_posix.cpp +++ b/drivers/unix/packet_peer_udp_posix.cpp @@ -121,7 +121,7 @@ Error PacketPeerUDPPosix::_poll(bool p_wait) { struct sockaddr_in from = {0}; socklen_t len = sizeof(struct sockaddr_in); int ret; - while ( (ret = recvfrom(sockfd, recv_buffer, MIN(sizeof(recv_buffer),rb.data_left()-12), p_wait?0:MSG_DONTWAIT, (struct sockaddr*)&from, &len)) > 0) { + while ( (ret = recvfrom(sockfd, recv_buffer, MIN(sizeof(recv_buffer),rb.space_left()-12), p_wait?0:MSG_DONTWAIT, (struct sockaddr*)&from, &len)) > 0) { rb.write((uint8_t*)&from.sin_addr, 4); uint32_t port = ntohs(from.sin_port); rb.write((uint8_t*)&port, 4); |