1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-31 11:23:40 +00:00

(libT) possible fix for #1389: bitcomet handshake with TransmissionBT failed

This commit is contained in:
Charles Kerr 2008-10-29 19:30:17 +00:00
parent 80d92b72d9
commit 4a8e34a35d

View file

@ -1018,10 +1018,13 @@ canRead( struct bufferevent * evin,
tr_handshake * handshake = (tr_handshake *) arg; tr_handshake * handshake = (tr_handshake *) arg;
struct evbuffer * inbuf = EVBUFFER_INPUT ( evin ); struct evbuffer * inbuf = EVBUFFER_INPUT ( evin );
ReadState ret; ReadState ret;
int readyForMore = TRUE;
dbgmsg( handshake, "handling canRead; state is [%s]", dbgmsg( handshake, "handling canRead; state is [%s]",
getStateName( handshake->state ) ); getStateName( handshake->state ) );
while( readyForMore )
{
switch( handshake->state ) switch( handshake->state )
{ {
case AWAITING_HANDSHAKE: case AWAITING_HANDSHAKE:
@ -1061,6 +1064,26 @@ canRead( struct bufferevent * evin,
assert( 0 ); assert( 0 );
} }
switch( handshake->state )
{
case AWAITING_PAD_C:
readyForMore = EVBUFFER_LENGTH( inbuf ) >= handshake->pad_c_len;
break;
case AWAITING_PAD_D:
readyForMore = EVBUFFER_LENGTH( inbuf ) >= handshake->pad_d_len;
break;
case AWAITING_IA:
readyForMore = EVBUFFER_LENGTH( inbuf ) >= handshake->ia_len;
break;
default:
readyForMore = ret == READ_NOW;
break;
}
}
return ret; return ret;
} }