daemon/dns: hand netaddr we connected to through to callback.

That way it doesn't have to extract it from fd.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-05-22 20:56:50 +09:30
parent f6495d3310
commit 0c8b24cf97
6 changed files with 23 additions and 11 deletions

View File

@@ -2996,20 +2996,15 @@ static struct io_plan *crypto_on_out(struct io_conn *conn,
static struct io_plan *peer_connected_out(struct io_conn *conn,
struct lightningd_state *dstate,
const struct netaddr *netaddr,
struct json_connecting *connect)
{
struct log *l;
struct netaddr addr;
l = new_log(conn, dstate->log_book, "OUT-%s:%s:",
connect->name, connect->port);
if (!netaddr_from_fd(io_conn_fd(conn), SOCK_STREAM, IPPROTO_TCP, &addr)) {
log_unusual(l, "Failed to get netaddr: %s", strerror(errno));
return io_close(conn);
}
log_debug_struct(l, "Connected out to %s", struct netaddr, &addr);
log_debug_struct(l, "Connected out to %s", struct netaddr, netaddr);
return peer_crypto_setup(conn, dstate, NULL, l, crypto_on_out, connect);
}