diff --git a/common-session.c b/common-session.c
index d1545e681243b2b599b2dd7a33ae6d5ebb85bfed..b48d2108aa09d0521941810c00f9b24750c634b1 100644
--- a/common-session.c
+++ b/common-session.c
@@ -189,7 +189,7 @@ void session_loop(void(*loophandler)()) {
 		/* 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 --git a/packet.c b/packet.c
index 4e2eedfc6910b5824718a4ee65b679129c9175d8..870d5d818337b9246f85463c071adbda280f27c4 100644
--- a/packet.c
+++ b/packet.c
@@ -46,16 +46,14 @@ static buffer* buf_decompress(buffer* buf, unsigned int len);
 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 @@ static int write_packet() {
 		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 --git a/packet.h b/packet.h
index db203d36c86512e38b32453b8afc7fd40aea74f6..8fadeb38a0de75e2e2f34effece96873dcb63281 100644
--- a/packet.h
+++ b/packet.h
@@ -28,7 +28,7 @@
 
 #include "includes.h"
 
-void write_packets();
+void write_packet();
 void read_packet();
 void decrypt_packet();
 void encrypt_packet();