| 955 | } |
| 956 | |
| 957 | static void connect_failed(struct daemon *daemon, |
| 958 | const struct node_id *id, |
| 959 | bool connect_attempted, |
| 960 | const char *connect_reason, |
| 961 | struct timemono start, |
| 962 | enum jsonrpc_errcode errcode, |
| 963 | const char *errfmt, ...) |
| 964 | { |
| 965 | u8 *msg; |
| 966 | va_list ap; |
| 967 | char *errmsg; |
| 968 | |
| 969 | va_start(ap, errfmt); |
| 970 | errmsg = tal_vfmt(tmpctx, errfmt, ap); |
| 971 | va_end(ap); |
| 972 | |
| 973 | status_peer_debug(id, "Failed connected out: %s", errmsg); |
| 974 | |
| 975 | /* lightningd may have a connect command waiting to know what |
| 976 | * happened. */ |
| 977 | msg = towire_connectd_connect_failed(NULL, id, |
| 978 | connect_reason, |
| 979 | time_to_nsec(timemono_since(start)), |
| 980 | errcode, errmsg, |
| 981 | connect_attempted); |
| 982 | daemon_conn_send(daemon->master, take(msg)); |
| 983 | |
| 984 | /* If we're supposed to schedule a reconnect, do so */ |
| 985 | schedule_reconnect_if_important(daemon, id); |
| 986 | |
| 987 | /* We limit thundering herd: let one out if waiting. */ |
| 988 | release_one_waiting_connection(daemon, |
| 989 | tal_fmt(tmpctx, "%s connect failure", |
| 990 | fmt_node_id(tmpctx, id))); |
| 991 | } |
| 992 | |
| 993 | /* add errors to error list */ |
| 994 | void add_errors_to_error_list(struct connecting *connect, const char *error) |
no test coverage detected