|
|
@ -16,6 +16,13 @@ struct gossip_store { |
|
|
|
__off_t replaysize; |
|
|
|
}; |
|
|
|
|
|
|
|
static void gossip_store_destroy(struct gossip_store *gs) |
|
|
|
{ |
|
|
|
if (gs->read_fd != -1) |
|
|
|
close(gs->read_fd); |
|
|
|
close(gs->write_fd); |
|
|
|
} |
|
|
|
|
|
|
|
struct gossip_store *gossip_store_new(const tal_t *ctx) |
|
|
|
{ |
|
|
|
struct gossip_store *gs = tal(ctx, struct gossip_store); |
|
|
@ -23,6 +30,8 @@ struct gossip_store *gossip_store_new(const tal_t *ctx) |
|
|
|
gs->read_fd = open(GOSSIP_STORE_FILENAME, O_RDONLY); |
|
|
|
gs->replaysize = lseek(gs->write_fd, 0, SEEK_END); |
|
|
|
|
|
|
|
tal_add_destructor(gs, gossip_store_destroy); |
|
|
|
|
|
|
|
return gs; |
|
|
|
} |
|
|
|
|
|
|
|