# HG changeset patch # User Matt Johnston # Date 1235654474 0 # Node ID c67c8c0c6c35fe65671d8a9e7e528cb06756fe20 # Parent 164b7c2cd5dfbc83dc212afc21185f58fb5a07e0# Parent 22a0d8355c2cd3d2195ad0c5a22ed3bcca2f35fe merge of 'e1c100e6366c5d607af08f4abdbb0f4281df4fa9' and 'fe8161b0698c9816b98f79e3cab2b9d59f2be71b' diff -r 22a0d8355c2c -r c67c8c0c6c35 common-session.c --- a/common-session.c Thu Feb 26 12:18:34 2009 +0000 +++ b/common-session.c Thu Feb 26 13:21:14 2009 +0000 @@ -189,7 +189,7 @@ /* process session socket's incoming/outgoing data */ if (ses.sock_out != -1) { if (FD_ISSET(ses.sock_out, &writefd) && !isempty(&ses.writequeue)) { - write_packets(); + write_packet(); } } diff -r 22a0d8355c2c -r c67c8c0c6c35 packet.c --- a/packet.c Thu Feb 26 12:18:34 2009 +0000 +++ b/packet.c Thu Feb 26 13:21:14 2009 +0000 @@ -46,16 +46,14 @@ static void buf_compress(buffer * dest, buffer * src, unsigned int len); #endif -/* non-blocking function writing out a current encrypted packet. Returns - * DROPBEAR_SUCCESS if entire packet was written, DROPBEAR_FAILURE - * otherwise */ -static int write_packet() { +/* non-blocking function writing out a current encrypted packet */ +void write_packet() { int len, written; - int ret = DROPBEAR_FAILURE; buffer * writebuf = NULL; TRACE(("enter write_packet")) + dropbear_assert(!isempty(&ses.writequeue)); /* Get the next buffer in the queue of encrypted packets to write*/ writebuf = (buffer*)examine(&ses.writequeue); @@ -86,19 +84,12 @@ dequeue(&ses.writequeue); buf_free(writebuf); writebuf = NULL; - ret = DROPBEAR_SUCCESS; } else { /* More packet left to write, leave it in the queue for later */ buf_incrpos(writebuf, written); } TRACE(("leave write_packet")) - return ret; -} - -void write_packets() { - /* keep writing packets while we can. */ - while (!isempty(&ses.writequeue) && write_packet() == DROPBEAR_SUCCESS) {} } /* Non-blocking function reading available portion of a packet into the diff -r 22a0d8355c2c -r c67c8c0c6c35 packet.h --- a/packet.h Thu Feb 26 12:18:34 2009 +0000 +++ b/packet.h Thu Feb 26 13:21:14 2009 +0000 @@ -28,7 +28,7 @@ #include "includes.h" -void write_packets(); +void write_packet(); void read_packet(); void decrypt_packet(); void encrypt_packet();