Skip to content

Commit 92c59ec

Browse files
committed
Revert "connectd: gate uniform message padding behind --dev-uniform-padding"
This reverts commit b5205f5.
1 parent 118fecd commit 92c59ec

1 file changed

Lines changed: 4 additions & 21 deletions

File tree

connectd/multiplex.c

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -485,16 +485,10 @@ static bool have_empty_encrypted_queue(const struct peer *peer)
485485
/* (Continue) writing the encrypted_peer_out array */
486486
static struct io_plan *write_encrypted_to_peer(struct peer *peer)
487487
{
488-
size_t avail = membuf_num_elems(&peer->encrypted_peer_out);
489-
/* With padding: always a full uniform-size chunk.
490-
* Without: flush whatever we have (caller ensures non-zero). */
491-
size_t write_size = peer->daemon->dev_uniform_padding
492-
? UNIFORM_MESSAGE_SIZE : avail;
493-
494-
assert(avail >= write_size && write_size > 0);
488+
assert(membuf_num_elems(&peer->encrypted_peer_out) >= UNIFORM_MESSAGE_SIZE);
495489
return io_write_partial(peer->to_peer,
496490
membuf_elems(&peer->encrypted_peer_out),
497-
write_size,
491+
UNIFORM_MESSAGE_SIZE,
498492
&peer->encrypted_peer_out_sent,
499493
write_to_peer, peer);
500494
}
@@ -1251,11 +1245,8 @@ static struct io_plan *write_to_peer(struct io_conn *peer_conn,
12511245
/* Wait for them to wake us */
12521246
return msg_queue_wait(peer_conn, peer->peer_outq, write_to_peer, peer);
12531247
}
1254-
/* OK, add padding (only if --dev-uniform-padding enabled). */
1255-
if (peer->daemon->dev_uniform_padding)
1256-
pad_encrypted_queue(peer);
1257-
else
1258-
break;
1248+
/* OK, add padding. */
1249+
pad_encrypted_queue(peer);
12591250
} else {
12601251
if (peer->draining_state == WRITING_TO_PEER)
12611252
status_peer_debug(&peer->id, "draining, but sending %s.",
@@ -1273,14 +1264,6 @@ static struct io_plan *write_to_peer(struct io_conn *peer_conn,
12731264
}
12741265

12751266
peer->nonurgent_flush_timer = tal_free(peer->nonurgent_flush_timer);
1276-
1277-
/* With uniform padding the buffer is always a full UNIFORM_MESSAGE_SIZE.
1278-
* Without it, write whatever we have; if nothing, go back to waiting. */
1279-
if (have_empty_encrypted_queue(peer)) {
1280-
io_wake(&peer->subds);
1281-
io_wake(&peer->peer_in);
1282-
return msg_queue_wait(peer_conn, peer->peer_outq, write_to_peer, peer);
1283-
}
12841267
return write_encrypted_to_peer(peer);
12851268
}
12861269

0 commit comments

Comments
 (0)