summaryrefslogtreecommitdiff
path: root/src/socket_base.hpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-04-14 10:08:19 +0200
committerMartin Sustrik <sustrik@250bpm.com>2012-04-15 06:55:29 +0200
commitee66c579dedf7130aa4d59afbf373f28c98eead5 (patch)
tree2b29d8e236b02789877da88ecf05d5b463c046da /src/socket_base.hpp
parent19894e0a1b6fbbcb62028fc6513ef3904a6f5c76 (diff)
Report EMFILE/ENFILE from xs_socket()
This patch propoagates the error from signaler and mailbox initialisation up the stack. To achieve this signaler and mailbox classes were re-written is C-like syntax. Finally, shutdown_stress test now ignores EMFILE/ENFILE errors. Thus, the tests should pass even on OSX which sets the max number of file descriptors pretty low by default. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/socket_base.hpp')
-rw-r--r--src/socket_base.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/socket_base.hpp b/src/socket_base.hpp
index 100b5c5..740fdde 100644
--- a/src/socket_base.hpp
+++ b/src/socket_base.hpp
@@ -130,6 +130,11 @@ namespace xs
private:
+ // Initialise the object. This function is separate from constructor
+ // so that it can return errors. If not successful, it deallocates
+ // the socket straight away.
+ int init ();
+
// To be called after processing commands or invoking any command
// handlers explicitly. If required, it will deallocate the socket.
void check_destroy ();
@@ -174,6 +179,7 @@ namespace xs
// Socket's mailbox object.
mailbox_t mailbox;
+ bool initialised;
// List of attached pipes.
typedef array_t <pipe_t, 3> pipes_t;