Skip to content

Commit

Permalink
[arch/linux] udp: only read up to available buffer space (#1622)
Browse files Browse the repository at this point in the history
In the udp read, the code first checks if there is space available in the transport buffer but then reads the maximum amount of data for the transport buffer, I simply changed it such that it reads up to the available limit of the transport buffer.
  • Loading branch information
kirkscheper authored and flixr committed Apr 23, 2016
1 parent 2a1ce1a commit 731adc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sw/airborne/arch/linux/mcu_periph/udp_arch.c
Expand Up @@ -121,7 +121,7 @@ void udp_receive(struct udp_periph *p)
}

socklen_t slen = sizeof(struct sockaddr_in);
ssize_t byte_read = recvfrom(sock->sockfd, buf, UDP_RX_BUFFER_SIZE, MSG_DONTWAIT,
ssize_t byte_read = recvfrom(sock->sockfd, buf, available, MSG_DONTWAIT,
(struct sockaddr *)&sock->addr_in, &slen);

pthread_mutex_lock(&udp_mutex);
Expand Down

0 comments on commit 731adc3

Please sign in to comment.