core-lightning/lightningd/peer_comms.c
Rusty Russell eaac0d7105 lightningd: group crypto_state and fds into a convenient structure.
These are always handed to subdaemons as a set, so group them.  This makes
it easier to add an fd (in the next patch).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-05-13 05:16:18 +00:00

19 lines
411 B
C

#include <lightningd/peer_comms.h>
#include <unistd.h>
static void destroy_peer_comms(struct peer_comms *pcomms)
{
if (pcomms->peer_fd != -1)
close(pcomms->peer_fd);
if (pcomms->gossip_fd != -1)
close(pcomms->gossip_fd);
}
struct peer_comms *new_peer_comms(const tal_t *ctx)
{
struct peer_comms *pcomms = tal(ctx, struct peer_comms);
tal_add_destructor(pcomms, destroy_peer_comms);
return pcomms;
}