Skip to content

Commit

Permalink
Make accept non blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
LasseRosenow committed Oct 25, 2024
1 parent 434ca79 commit 9fb2861
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/riot/blinky/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ DEVELHELP ?= 1
QUIET ?= 1

# Enable reactor-uc features
# CFLAGS += -DNETWORK_POSIX_TCP
CFLAGS += -DNETWORK_POSIX_TCP

include $(CURDIR)/../../../make/riot/riot.mk
6 changes: 6 additions & 0 deletions src/platform/posix/tcp_ip_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -279,6 +280,11 @@ void TcpIpChannel_ctor(TcpIpChannel *self, const char *host, unsigned short port
throw("Could not set SO_REUSEADDR");
}

// Set server socket to non-blocking
if (server) {
fcntl(self->fd, F_SETFL, O_NONBLOCK);
}

self->server = server;
self->terminate = true;
self->protocol_family = protocol_family;
Expand Down

0 comments on commit 9fb2861

Please sign in to comment.