Browse files

Use maximum UDP packet size on IPv6 sockets.

  • Loading branch information...
1 parent 115ebf6 commit 1dec0397bd18bfa6cd4f8820ae9e326e108a6d2b @erichocean committed Mar 10, 2014
Showing with 3 additions and 1 deletion.
  1. +3 −1 GCD/GCDAsyncUdpSocket.m
View
4 GCD/GCDAsyncUdpSocket.m
@@ -4330,7 +4330,9 @@ - (void)doReceive
struct sockaddr_in6 sockaddr6;
socklen_t sockaddr6len = sizeof(sockaddr6);
- size_t bufSize = MIN(max6ReceiveSize, socket6FDBytesAvailable);
+ // #222: GCD does not necessarily return the size of an entire UDP packet
+ // from dispatch_source_get_data(), so we must use the maximum packet size.
+ size_t bufSize = max6ReceiveSize;
void *buf = malloc(bufSize);
result = recvfrom(socket6FD, buf, bufSize, 0, (struct sockaddr *)&sockaddr6, &sockaddr6len);

0 comments on commit 1dec039

Please sign in to comment.