mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
log: add netaddr
Also avoids allocating netaddr_name which otherwise lasts as long as connection does. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
4c7017f607
commit
8015ceadfd
@ -45,6 +45,13 @@ struct timeabs controlled_time(void)
|
|||||||
return time_now();
|
return time_now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct netaddr;
|
||||||
|
char *netaddr_name(const tal_t *ctx, const struct netaddr *a);
|
||||||
|
char *netaddr_name(const tal_t *ctx, const struct netaddr *a)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int fd, i, off;
|
int fd, i, off;
|
||||||
|
@ -349,6 +349,8 @@ static char *to_string_(const tal_t *ctx,
|
|||||||
&u.cstate->side[LOCAL]),
|
&u.cstate->side[LOCAL]),
|
||||||
to_string(ctx, lr, struct channel_oneside,
|
to_string(ctx, lr, struct channel_oneside,
|
||||||
&u.cstate->side[REMOTE]));
|
&u.cstate->side[REMOTE]));
|
||||||
|
} else if (streq(structname, "struct netaddr")) {
|
||||||
|
s = netaddr_name(ctx, u.netaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
@ -90,6 +90,7 @@ union loggable_structs {
|
|||||||
const struct rval *rval;
|
const struct rval *rval;
|
||||||
const struct channel_state *cstate;
|
const struct channel_state *cstate;
|
||||||
const struct channel_oneside *channel_oneside;
|
const struct channel_oneside *channel_oneside;
|
||||||
|
const struct netaddr *netaddr;
|
||||||
const char *charp_;
|
const char *charp_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2668,7 +2668,6 @@ static struct io_plan *peer_connected_out(struct io_conn *conn,
|
|||||||
struct json_connecting *connect)
|
struct json_connecting *connect)
|
||||||
{
|
{
|
||||||
struct log *l;
|
struct log *l;
|
||||||
const char *name;
|
|
||||||
struct netaddr addr;
|
struct netaddr addr;
|
||||||
|
|
||||||
l = new_log(conn, dstate->log_record, "OUT-%s:%s:",
|
l = new_log(conn, dstate->log_record, "OUT-%s:%s:",
|
||||||
@ -2678,9 +2677,8 @@ static struct io_plan *peer_connected_out(struct io_conn *conn,
|
|||||||
log_unusual(l, "Failed to get netaddr: %s", strerror(errno));
|
log_unusual(l, "Failed to get netaddr: %s", strerror(errno));
|
||||||
return io_close(conn);
|
return io_close(conn);
|
||||||
}
|
}
|
||||||
name = netaddr_name(conn, &addr);
|
|
||||||
|
|
||||||
log_debug(l, "Connected out to %s", name);
|
log_debug_struct(l, "Connected out to %s", struct netaddr, &addr);
|
||||||
return peer_crypto_setup(conn, dstate, NULL, l, crypto_on_out, connect);
|
return peer_crypto_setup(conn, dstate, NULL, l, crypto_on_out, connect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user