summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a3da02f)
raw | patch | inline | side by side (parent: a3da02f)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 17 Dec 2013 19:13:16 +0000 (20:13 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 17 Dec 2013 19:13:16 +0000 (20:13 +0100) |
That is, do not (re-)open any sockets.
src/frontend/sock.c | patch | blob | history | |
t/frontend/sock_test.c | patch | blob | history |
diff --git a/src/frontend/sock.c b/src/frontend/sock.c
index 65884ea945bf61fe935b48fe60ab819b453b1eb8..27aa1c5653086a8c073b5c8dbb71c441b268e0be 100644 (file)
--- a/src/frontend/sock.c
+++ b/src/frontend/sock.c
if ((! sock) || (! sock->listeners_num) || (! loop) || sock->chan)
return -1;
+ if (! loop->do_loop)
+ return 0;
+
FD_ZERO(&sockets);
for (i = 0; i < sock->listeners_num; ++i) {
listener_t *listener = sock->listeners + i;
diff --git a/t/frontend/sock_test.c b/t/frontend/sock_test.c
index 4ac8196d9dba07ac89de64d28002242793601511..5579e3647b5f19d36990e4f56a81a9fd3d8f1780 100644 (file)
--- a/t/frontend/sock_test.c
+++ b/t/frontend/sock_test.c
pthread_join(thr, NULL);
unlink(tmp_file);
+
+ /* should do nothing and not report errors */
+ check = sdb_fe_sock_listen_and_serve(sock, &loop);
+ fail_unless(check == 0,
+ "sdb_fe_sock_listen_and_serve() = %i; "
+ "expected: <0 (do_loop == 0)", check);
+ fail_unless(access(tmp_file, F_OK),
+ "sdb_fe_sock_listen_and_serve() recreated socket "
+ "(do_loop == 0)");
}
END_TEST