This commit is contained in:
Charles Kerr 2008-10-29 20:06:44 +00:00
parent 4a8e34a35d
commit 8518da7193
1 changed files with 9 additions and 19 deletions

View File

@ -927,7 +927,7 @@ readIA( tr_handshake * handshake,
struct evbuffer * inbuf ) struct evbuffer * inbuf )
{ {
int i; int i;
const size_t needlen = handshake->ia_len; const size_t needlen = handshake->ia_len + HANDSHAKE_SIZE;
struct evbuffer * outbuf; struct evbuffer * outbuf;
uint32_t crypto_select; uint32_t crypto_select;
@ -1064,24 +1064,14 @@ canRead( struct bufferevent * evin,
assert( 0 ); assert( 0 );
} }
switch( handshake->state ) if( ret != READ_NOW )
{ readyForMore = FALSE;
case AWAITING_PAD_C: else if( handshake->state == AWAITING_PAD_C )
readyForMore = EVBUFFER_LENGTH( inbuf ) >= handshake->pad_c_len; readyForMore = EVBUFFER_LENGTH( inbuf ) >= handshake->pad_c_len;
break; else if( handshake->state == AWAITING_PAD_D )
readyForMore = EVBUFFER_LENGTH( inbuf ) >= handshake->pad_d_len;
case AWAITING_PAD_D: else if( handshake->state == AWAITING_IA )
readyForMore = EVBUFFER_LENGTH( inbuf ) >= handshake->pad_d_len; readyForMore = EVBUFFER_LENGTH( inbuf ) >= handshake->ia_len;
break;
case AWAITING_IA:
readyForMore = EVBUFFER_LENGTH( inbuf ) >= handshake->ia_len;
break;
default:
readyForMore = ret == READ_NOW;
break;
}
} }
return ret; return ret;