From 1b39bcd88336ebed002e13a8ac3d4bc104b13718 Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Thu, 4 Nov 2010 17:54:47 +0100 Subject: Automatically resize signalling socket buffer if full If the socketpair used by signaler_t fills up, this can lead to deadlock. This patch provides partial resolution by attempting to resize SO_SNDBUF on the writer side, and if that fails we shall at least assert rather than hang. I've also refactored the signaler_t code to make the platform-dependent parts clearer and have tested both the MSG_DONTWAIT and standard POSIX path in recv. The Win32 implementation currently does not implement resizing as I'm not convinced that it's safe, but it will also assert like other platforms if signaler_t::send() cannot succeed. The OpenVMS implementation has been carried forward but is untested. Signed-off-by: Martin Lucina --- src/signaler.hpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/signaler.hpp') diff --git a/src/signaler.hpp b/src/signaler.hpp index 3e5ff13..faf3f1f 100644 --- a/src/signaler.hpp +++ b/src/signaler.hpp @@ -44,24 +44,14 @@ namespace zmq private: -#if defined ZMQ_HAVE_OPENVMS - - // Whilst OpenVMS supports socketpair - it maps to AF_INET only. - // Further, it does not set the socket options TCP_NODELAY and - // TCP_NODELACK which can lead to performance problems. We'll - // overload the socketpair function for this class. - // - // The bug will be fixed in V5.6 ECO4 and beyond. In the - // meantime, we'll create the socket pair manually. - static int socketpair (int domain_, int type_, int protocol_, - int sv_ [2]); -#endif - // Write & read end of the socketpair. fd_t w; fd_t r; - // Disable copying of fd_signeler object. + // Platform-dependent function to create a socketpair. + static int make_socketpair (fd_t *r_, fd_t *w_); + + // Disable copying of signaler_t object. signaler_t (const signaler_t&); void operator = (const signaler_t&); }; -- cgit v1.2.3