summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 748bf08)
raw | patch | inline | side by side (parent: 748bf08)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 25 Oct 2013 16:57:28 +0000 (18:57 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 25 Oct 2013 16:57:28 +0000 (18:57 +0200) |
src/frontend/sock.c | patch | blob | history |
diff --git a/src/frontend/sock.c b/src/frontend/sock.c
index 3662a2650cc41d313ea5c6e8613c59810825fd50..a389a142b94f8a1a609a02a2ae1773239dc0e624 100644 (file)
--- a/src/frontend/sock.c
+++ b/src/frontend/sock.c
#include <unistd.h>
+#include <fcntl.h>
+
#include <sys/time.h>
#include <sys/types.h>
#include <sys/select.h>
{
connection_t *conn;
int sock_fd;
+ int sock_fl;
assert(obj);
conn = &CONN(obj)->conn;
return -1;
}
- sdb_log(SDB_LOG_DEBUG, "frontend: Accepted connection on fd=%i\n",
+ sock_fl = fcntl(conn->fd, F_GETFL);
+ if (fcntl(conn->fd, F_SETFL, sock_fl | O_NONBLOCK)) {
+ char buf[1024];
+ sdb_log(SDB_LOG_ERR, "frontend: Failed to switch connection conn#%i "
+ "to non-blocking mode: %s", conn->fd,
+ sdb_strerror(errno, buf, sizeof(buf)));
+ return -1;
+ }
+
+ sdb_log(SDB_LOG_DEBUG, "frontend: Accepted connection on fd=%i",
conn->fd);
/* update the object name */