summaryrefslogtreecommitdiff
path: root/src/tcp_connecter.cpp
AgeCommit message (Collapse)Author
2012-05-04Correct handling of connect() errors in tcp, ipc_connecter_tMartin Lucina
EAGAIN was being used as a translation value for EINPROGRESS, thus shadowing a real EAGAIN return value from the OS. This caused later assertions of "Invalid argument" in stream_engine.cpp when it attempted to use a socket which was not connected. I also add EINTR to mean EINPROGRESS, as per the POSIX and FreeBSD documentation which specifies that a connect() call interrupted due to a signal will complete asynchronously. Signed-off-by: Martin Lucina <martin@lucina.net>
2012-04-29Fix TCP/IPC socket shutdownMartin Sustrik
When socket in the process of asynchronous connect is being closed and the fact that there is no peer is found out at the same time close() may return ECONNRESET. This patch handles this situation decently. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-25tcp_address_t and ipc_address_t merged into a single classMartin Sustrik
This patch is a preliminary work for mergine TCP and IPC connecters and listeners. The ultimated goal is to avoid code duplication occuring in these classes. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-14Set options on new sockets in systematic mannerMartin Sustrik
This patch consolidates the up-to-now scattered code that sets different options on newly created sockets. There are open_socket and open_tcp_socket functions that do the tuning automatically. In case the socket is not created but got from elsewhere (such as accept() call) there are tune_socket and tune_tcp_socket functions that will do the tuning. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-07Fix error handling in TCP and IPC connectersMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-03-28XS_KEEPALIVE options addedMartin Sustrik
This option allows to turn on TCP keepalives on the underlying connections. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16Full name of the project used in license headersMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16poller_base_t renamed to io_thread_tMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16io_thread_t merged with poller_base_tMartin Sustrik
The relationship of these two classes was 1:1. Thus one of them was obsolete. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16handle_valid removed from tcp_connecter_t and ipc_connecter_tMartin Sustrik
Invalid handle is now specified as handle == NULL Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16Timers identified by dynamically generated handlesMartin Sustrik
Timers are not longer identified by hard-wired IDs. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16cancel_timer function renamed to rm_timerMartin Sustrik
This is more consistent with adjacent add_fd and rm_fd functions. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16File descriptor passed to in_event and out_eventMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16Allow to set up a source address for outgoing connections in zmq_connect()Sergey Matveychuk
Signed-off-by: Sergey Matveychuk <sem33@yandex-team.ru> Signed-off-by: Martin Sustrik <sustik@250bpm.com>
2012-02-16Updated connector open() doc strings.Ivo Danihelka
Signed-off-by: Ivo Danihelka <ivo@danihelka.net>
2012-02-16ZeroMQ renamed to CrossroadsMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-12-15A synchronous connect() failure in ipc_connecter can result in AssertionMartin Lucina
failed: s == retired_fd (ipc_connecter.cpp:174), as reported in LIBZMQ-294. This patch fixes the bug, and also an identical problem in tcp_connecter which has not hit people since TCP connect() usually completes via the asynchronous code path (poll, out_event). Signed-off-by: Martin Lucina <martin@lucina.net>
2011-11-01Copyright dates adjusted to reflect realityMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31250bpm copyrights addedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-15Session class separated into socket-type-specific sessionsMartin Sustrik
This is a preliminary patch allowing for socket-type-specific functionality in the I/O thread. For example, message format can be checked asynchronously and misbehaved connections dropped straight away. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-03Improve error reporting in a minor wayMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-02Close file descriptors on exec (issue 218)Martin Sustrik
When exec is executed to start a different process image old 0MQ file descriptors could stay open, thus blocking TCP ports and alike. This patch should solve the problem. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-18TCP address related functionality moved to tcp_address_tMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-16tcp_engine renamed to stream engineMartin Sustrik
The engine was not used exclusively for TCP connections. Rather it was used to handle any socket with SOCK_STREAM semantics. The class was renamed to reflect its true function. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-15Add IPv6 support to tcp_listenerSteven McCoy
Signed-off-by: Steven McCoy <steven.mccoy@miru.hk> Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-15Minor problems in MSVC build fixedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-08Minor compile-time bug on Windows fixedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-08tcp_connecter disables IPV6_IPV6ONLY if needed.Steven McCoy
Signed-off-by: Steven McCoy <steven.mccoy@miru.hk> Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-08Update resolve_ip_interface and resolve_ip_hostname with ipv4only parameter.Steven McCoy
Signed-off-by: Steven McCoy <steven.mccoy@miru.hk> Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-29Different connecters simplifiedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-28Tuning of TCP sockets is done at a single placeMartin Sustrik
Instead of being spread throughout the codebase, the tuning is done in tune_tcp_socket() function. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-28Implementations of TCP and IPC transports separatedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-28Precise reconnect interval randomisedMartin Sustrik
Till now the random fraction of the reconnect interval was computed based on process ID. This patch uses pseudo-random generated (seeded by exact time of when the process was started) to compute the interval. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-28Setting TCP socket options moved to tcp_engine_tMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-26Code cleanupMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-26Experimental VTCP listener addedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-26TCP transport classes simplifiedMartin Sustrik
zmq_engine and tcp_socket merged into tcp_engine zmq_connecter and tcp_connecter merged into tcp_connecter zmq_listener and tcp_listener merged into tcp_listener Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-19ENETDOWN is a legal error from TCP connectMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-14ENETUNREACH is a valid error from connectMartin Sustrik
This patch fixed the JIRA issue 223 Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-05-08Async connect doesn't fail on EWSANETDOWNMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-29WSAENETUNREACH is a valid networking errorMartin Sustrik
Till now, 0MQ asserted on Windows when connect () returned WSAENETUNREACH. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-21Message-related functionality factored out into msg_t class.Martin Sustrik
This patch addresses serveral issues: 1. It gathers message related functionality scattered over whole codebase into a single class. 2. It makes zmq_msg_t an opaque datatype. Internals of the class don't pollute zmq.h header file. 3. zmq_msg_t size decreases from 48 to 32 bytes. That saves ~33% of memory in scenarios with large amount of small messages. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-02The copyrights in file headers updated.Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-30Name of "GNU Lesser Public License" corrected.Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-07-13minor comment clarificationMartin Sustrik
2010-06-11if connect asserts, exact error is reportedMartin Sustrik
2010-06-11EHOSTUNREACH is acceptable outcome from connectMartin Sustrik
2010-06-10issue 31 - Assertion failed: err == ECONNREFUSED || err == ETIMEDOUT ↵Martin Sustrik
(tcp_connecter.cpp:296)
2010-06-07minor comment clarificationMartin Sustrik
2010-05-12fixes for OpenVMSBrett Cameron