summaryrefslogtreecommitdiff
path: root/platform/windows/packet_peer_udp_winsock.cpp
diff options
context:
space:
mode:
authorTrond Abusdal <trond.abusdal@gmail.com>2015-11-19 19:06:01 +0100
committerTrond Abusdal <trond.abusdal@gmail.com>2015-11-19 19:06:01 +0100
commita8a2458f0b490ee323632c95543106232efd8042 (patch)
tree762b071a71843b074292402e08171305e78c2e3d /platform/windows/packet_peer_udp_winsock.cpp
parent41a161647dd8f3f0bfa5727ee1b357ea8605c348 (diff)
Fixed mistake where available buffer size would not be updated for each recvfrom-call in PacketPeerUDPWinsockPposix.
Diffstat (limited to 'platform/windows/packet_peer_udp_winsock.cpp')
-rw-r--r--platform/windows/packet_peer_udp_winsock.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/platform/windows/packet_peer_udp_winsock.cpp b/platform/windows/packet_peer_udp_winsock.cpp
index 04d526e443..0ca2d358af 100644
--- a/platform/windows/packet_peer_udp_winsock.cpp
+++ b/platform/windows/packet_peer_udp_winsock.cpp
@@ -120,10 +120,8 @@ Error PacketPeerUDPWinsock::_poll(bool p_wait) {
struct sockaddr_in from = {0};
int len = sizeof(struct sockaddr_in);
- int rb_size = MAX(rb.space_left()-12, 0);
- int buffer_size = MIN((int)sizeof(recv_buffer),rb_size);
int ret;
- while ( (ret = recvfrom(sockfd, (char*)recv_buffer, buffer_size, 0, (struct sockaddr*)&from, &len)) > 0) {
+ while ( (ret = recvfrom(sockfd, (char*)recv_buffer, MIN((int)sizeof(recv_buffer),MAX(rb.space_left()-12, 0)), 0, (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);