Browse Source

daemon: remove pending input and command queues.

we don't use them any more.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
400d415172
  1. 35
      daemon/peer.c
  2. 6
      daemon/peer.h

35
daemon/peer.c

@ -49,18 +49,6 @@ struct json_connecting {
struct anchor_input *input;
};
struct pending_cmd {
struct list_node list;
void (*dequeue)(struct peer *, void *arg);
void *arg;
};
struct pending_input {
struct list_node list;
enum state_input input;
union input idata;
};
static struct peer *find_peer(struct lightningd_state *dstate,
const char *buffer,
jsmntok_t *peeridtok)
@ -574,24 +562,10 @@ static void state_single(struct peer *peer,
io_break(peer);
}
static void UNNEEDED queue_input(struct peer *peer,
enum state_input input,
const union input *idata)
{
struct pending_input *pend = tal(peer, struct pending_input);
pend->input = input;
if (idata)
pend->idata = *idata;
list_add_tail(&peer->pending_input, &pend->list);
}
static void state_event(struct peer *peer,
const enum state_input input,
const union input *idata)
{
struct pending_input *pend;
if (!state_is_opening(peer->state) && !state_is_normal(peer->state)) {
log_unusual(peer->log,
"Unexpected input %s while state %s",
@ -599,12 +573,6 @@ static void state_event(struct peer *peer,
} else {
state_single(peer, input, idata);
}
pend = list_pop(&peer->pending_input, struct pending_input, list);
if (pend) {
state_event(peer, pend->input, &pend->idata);
tal_free(pend);
}
}
static struct io_plan *pkt_out(struct io_conn *conn, struct peer *peer)
@ -772,8 +740,6 @@ static struct peer *new_peer(struct lightningd_state *dstate,
list_head_init(&peer->watches);
peer->outpkt = tal_arr(peer, Pkt *, 0);
peer->commit_jsoncmd = NULL;
list_head_init(&peer->pending_cmd);
list_head_init(&peer->pending_input);
list_head_init(&peer->outgoing_txs);
peer->close_watch_timeout = NULL;
peer->anchor.watches = NULL;
@ -2276,7 +2242,6 @@ static void json_add_htlcs(struct json_result *response,
/* FIXME: add history command which shows all prior and current commit txs */
/* FIXME: Somehow we should show running DNS lookups! */
/* FIXME: Show status of peers! */
static void json_getpeers(struct command *cmd,
const char *buffer, const jsmntok_t *params)
{

6
daemon/peer.h

@ -124,12 +124,6 @@ struct peer {
/* If we're doing a commit, this is the command which triggered it */
struct command *commit_jsoncmd;
/* Pending inputs. */
struct list_head pending_input;
/* Pending commands. */
struct list_head pending_cmd;
/* Global state. */
struct lightningd_state *dstate;

Loading…
Cancel
Save