Skip to content

Commit

Permalink
Merge pull request #35 from jandubois/switch-no-buffer-available
Browse files Browse the repository at this point in the history
Thanks @jandubois !
  • Loading branch information
danielinux committed Dec 13, 2021
2 parents 534a094 + 5bb8951 commit 74278b9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/vde_switch/datasock.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <libgen.h>
#include <sched.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
Expand Down Expand Up @@ -87,8 +88,14 @@ union request {

static int send_datasock(int fd_ctl, int fd_data, void *packet, int len, int port)
{
if (send(fd_data, packet, len, 0) < 0) {
while (send(fd_data, packet, len, 0) < 0) {
int rv=errno;
#if defined(VDE_DARWIN) || defined(VDE_FREEBSD)
if(rv == ENOBUFS) {
sched_yield();
continue;
}
#endif
if(rv != EAGAIN && rv != EWOULDBLOCK)
printlog(LOG_WARNING,"send_sockaddr port %d: %s",port,strerror(errno));
else
Expand Down

0 comments on commit 74278b9

Please sign in to comment.