Mercurial > dropbear
diff packet.c @ 1577:399d8eb961b5
get rid of unused packet_type in encrypted write queue
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 04 Mar 2018 14:57:18 +0800 |
parents | 92c93b4a3646 |
children | 8f7b6f75aa58 |
line wrap: on
line diff
--- a/packet.c Sat Mar 03 11:11:04 2018 +0800 +++ b/packet.c Sun Mar 04 14:57:18 2018 +0800 @@ -65,7 +65,6 @@ #else int len; buffer* writebuf; - int packet_type; #endif TRACE2(("enter write_packet")) @@ -113,10 +112,7 @@ /* The last byte of the buffer is not to be transmitted, but is * a cleartext packet_type indicator */ - packet_type = writebuf->data[writebuf->len-1]; - len = writebuf->len - 1 - writebuf->pos; - TRACE2(("write_packet type %d len %d/%d", packet_type, - len, writebuf->len-1)) + len = writebuf->len - writebuf->pos; dropbear_assert(len > 0); /* Try to write as much as possible */ written = write(ses.sock_out, buf_getptr(writebuf, len), len); @@ -604,7 +600,7 @@ /* Update counts */ ses.kexstate.datatrans += writebuf->len; - writebuf_enqueue(writebuf, packet_type); + writebuf_enqueue(writebuf); /* Update counts */ ses.transseq++; @@ -624,14 +620,11 @@ TRACE2(("leave encrypt_packet()")) } -void writebuf_enqueue(buffer * writebuf, unsigned char packet_type) { - /* The last byte of the buffer stores the cleartext packet_type. It is not - * transmitted but is used for transmit timeout purposes */ - buf_putbyte(writebuf, packet_type); +void writebuf_enqueue(buffer * writebuf) { /* enqueue the packet for sending. It will get freed after transmission. */ buf_setpos(writebuf, 0); enqueue(&ses.writequeue, (void*)writebuf); - ses.writequeue_len += writebuf->len-1; + ses.writequeue_len += writebuf->len; }