summaryrefslogtreecommitdiff
path: root/socket-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-15 06:19:54 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-15 06:20:00 +0200
commit4f2d528d3bb25cebf8d3ebe83d8193ab4016cb90 (patch)
tree96336ea5c252c903ab4666d49714ececf949dfdf /socket-util.c
parent9e2f7c11fb6ba35ffec2274da3e2d08b10d23965 (diff)
socket: optionally call accept() for incoming connections and spawn one service instance per connection
Diffstat (limited to 'socket-util.c')
-rw-r--r--socket-util.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/socket-util.c b/socket-util.c
index 96567c6d81..cd5ab82a23 100644
--- a/socket-util.c
+++ b/socket-util.c
@@ -316,7 +316,7 @@ int socket_address_listen(
if ((r = socket_address_verify(a)) < 0)
return r;
- if ((fd = socket(socket_address_family(a), a->type | SOCK_NONBLOCK | SOCK_CLOEXEC, 0)) < 0)
+ if ((fd = socket(socket_address_family(a), a->type | SOCK_NONBLOCK, 0)) < 0)
return -errno;
if (socket_address_family(a) == AF_INET6 && only != SOCKET_ADDRESS_DEFAULT) {
@@ -373,3 +373,11 @@ fail:
close_nointr(fd);
return r;
}
+
+bool socket_address_can_accept(const SocketAddress *a) {
+ assert(a);
+
+ return
+ a->type == SOCK_STREAM ||
+ a->type == SOCK_SEQPACKET;
+}