Resolve addresses in the calling thread on connect.

This allows us to actually report an error to the caller on resolve
failure, rather than asserting later on in the io thread.

Signed-off-by: Staffan Gimåker <staffan@spotify.com>
This commit is contained in:
Staffan Gimåker
2012-02-02 14:56:51 +01:00
parent b2e2fa622d
commit b9fb48f47b
40 changed files with 292 additions and 130 deletions

View File

@@ -26,13 +26,13 @@
#include "own.hpp"
#include "stdint.hpp"
#include "io_object.hpp"
#include "tcp_address.hpp"
namespace zmq
{
class io_thread_t;
class session_base_t;
struct address_t;
class tcp_connecter_t : public own_t, public io_object_t
{
@@ -42,7 +42,7 @@ namespace zmq
// connection process.
tcp_connecter_t (zmq::io_thread_t *io_thread_,
zmq::session_base_t *session_, const options_t &options_,
const char *address_, bool delay_);
const address_t *addr_, bool delay_);
~tcp_connecter_t ();
private:
@@ -69,9 +69,6 @@ namespace zmq
// Returns the currently used interval
int get_new_reconnect_ivl ();
// Set address to connect to.
int set_address (const char *addr_);
// Open TCP connecting socket. Returns -1 in case of error,
// 0 if connect was successfull immediately. Returns -1 with
// EAGAIN errno if async connect was launched.
@@ -84,8 +81,8 @@ namespace zmq
// retired_fd if the connection was unsuccessfull.
fd_t connect ();
// Address to connect to.
tcp_address_t address;
// Address to connect to. Owned by session_base_t.
const address_t *addr;
// Underlying socket.
fd_t s;