mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-09 09:04:25 +01:00
common/read_peer_msg: handle pings in handle_peer_gossip_or_error().
This is a noop for now, since gossipd handles them. But that will change in the next patch. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
6dc7fc6aee
commit
c394fd5db2
@@ -47,6 +47,7 @@ CLOSINGD_COMMON_OBJS := \
|
||||
common/peer_failed.o \
|
||||
common/per_peer_state.o \
|
||||
common/permute_tx.o \
|
||||
common/ping.o \
|
||||
common/psbt_open.o \
|
||||
common/pseudorand.o \
|
||||
common/read_peer_msg.o \
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <common/gossip_store.h>
|
||||
#include <common/peer_failed.h>
|
||||
#include <common/per_peer_state.h>
|
||||
#include <common/ping.h>
|
||||
#include <common/read_peer_msg.h>
|
||||
#include <common/status.h>
|
||||
#include <common/wire_error.h>
|
||||
@@ -156,6 +157,7 @@ bool handle_peer_gossip_or_error(struct per_peer_state *pps,
|
||||
{
|
||||
char *err;
|
||||
bool warning;
|
||||
u8 *pong;
|
||||
|
||||
#if DEVELOPER
|
||||
/* Any odd-typed unknown message is handled by the caller, so if we
|
||||
@@ -174,7 +176,11 @@ bool handle_peer_gossip_or_error(struct per_peer_state *pps,
|
||||
|
||||
if (handle_timestamp_filter(pps, msg))
|
||||
return true;
|
||||
else if (is_msg_for_gossipd(msg)) {
|
||||
else if (check_ping_make_pong(NULL, msg, &pong)) {
|
||||
if (pong)
|
||||
sync_crypto_write(pps, take(pong));
|
||||
return true;
|
||||
} else if (is_msg_for_gossipd(msg)) {
|
||||
gossip_rcvd_filter_add(pps->grf, msg);
|
||||
wire_sync_write(pps->gossip_fd, msg);
|
||||
/* wire_sync_write takes, so don't take again. */
|
||||
|
||||
@@ -63,7 +63,7 @@ bool is_wrong_channel(const u8 *msg, const struct channel_id *expected,
|
||||
*
|
||||
* This returns true if it handled the packet: a gossip packet (forwarded
|
||||
* to gossipd), or an error packet (causes peer_failed_received_errmsg or
|
||||
* ignored).
|
||||
* ignored), or a ping (may reply with pong).
|
||||
*/
|
||||
bool handle_peer_gossip_or_error(struct per_peer_state *pps,
|
||||
const struct channel_id *channel_id,
|
||||
|
||||
@@ -70,6 +70,7 @@ OPENINGD_COMMON_OBJS := \
|
||||
common/peer_billboard.o \
|
||||
common/peer_failed.o \
|
||||
common/permute_tx.o \
|
||||
common/ping.o \
|
||||
common/psbt_internal.o \
|
||||
common/psbt_open.o \
|
||||
common/pseudorand.o \
|
||||
|
||||
Reference in New Issue
Block a user