Mercurial > dropbear
changeset 751:685d05f1cc5c
Just put the version string on the queue, don't use atomicio
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 03 Apr 2013 19:23:53 +0800 |
parents | a813e2752fdb |
children | 24172f555f9c |
files | common-session.c process-packet.c |
diffstat | 2 files changed, 6 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/common-session.c Wed Apr 03 07:34:18 2013 +0800 +++ b/common-session.c Wed Apr 03 19:23:53 2013 +0800 @@ -33,7 +33,6 @@ #include "random.h" #include "kex.h" #include "channel.h" -#include "atomicio.h" #include "runopts.h" static void checktimeouts(); @@ -50,8 +49,6 @@ /* this is set when we get SIGINT or SIGTERM, the handler is in main.c */ int exitflag = 0; /* GLOBAL */ - - /* called only at the start of a session, set up initial state */ void common_session_init(int sock_in, int sock_out) { @@ -257,13 +254,12 @@ TRACE(("leave session_cleanup")) } - void send_session_identification() { - /* write our version string, this blocks */ - if (atomicio(write, ses.sock_out, LOCAL_IDENT "\r\n", - strlen(LOCAL_IDENT "\r\n")) == DROPBEAR_FAILURE) { - ses.remoteclosed(); - } + buffer *writebuf = buf_new(strlen(LOCAL_IDENT "\r\n") + 1); + buf_putbytes(writebuf, LOCAL_IDENT "\r\n", strlen(LOCAL_IDENT "\r\n")); + buf_putbyte(writebuf, 0x0); // packet type + buf_setpos(writebuf, 0); + enqueue(&ses.writequeue, writebuf); } static void read_session_identification() {
--- a/process-packet.c Wed Apr 03 07:34:18 2013 +0800 +++ b/process-packet.c Wed Apr 03 19:23:53 2013 +0800 @@ -48,7 +48,7 @@ TRACE2(("enter process_packet")) type = buf_getbyte(ses.payload); - TRACE(("process_packet: packet type = %d", type)) + TRACE(("process_packet: packet type = %d, len %d", type, ses.payload->len)) ses.lastpacket = type;