1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00

minor tweaks.

This commit is contained in:
Charles Kerr 2007-11-08 21:25:17 +00:00
parent 125bd34bbb
commit 39f9f14751
3 changed files with 9 additions and 9 deletions

View file

@ -25,7 +25,6 @@
#include "fdlimit.h" #include "fdlimit.h"
#include "inout.h" #include "inout.h"
#include "list.h" #include "list.h"
#include "net.h"
#include "platform.h" #include "platform.h"
#include "peer-mgr.h" #include "peer-mgr.h"
#include "utils.h" #include "utils.h"

View file

@ -503,11 +503,11 @@ tr_peerIoReadBytes( tr_peerIo * io,
switch( io->encryptionMode ) switch( io->encryptionMode )
{ {
case PEER_ENCRYPTION_NONE: case PEER_ENCRYPTION_NONE:
evbuffer_remove( inbuf, bytes, byteCount ); evbuffer_remove( inbuf, bytes, byteCount );
break; break;
case PEER_ENCRYPTION_RC4: case PEER_ENCRYPTION_RC4:
evbuffer_remove( inbuf, bytes, byteCount ); evbuffer_remove( inbuf, bytes, byteCount );
tr_cryptoDecrypt( io->crypto, byteCount, bytes, bytes ); tr_cryptoDecrypt( io->crypto, byteCount, bytes, bytes );
break; break;

View file

@ -965,6 +965,7 @@ readBtMessage( tr_peermsgs * msgs, struct evbuffer * inbuf )
if( !messageLengthIsCorrect( msgs, id, msglen ) ) if( !messageLengthIsCorrect( msgs, id, msglen ) )
{ {
dbgmsg( msgs, "bad packet - BT message #%d with a length of %d", (int)id, (int)msglen );
fireGotError( msgs ); fireGotError( msgs );
return READ_DONE; return READ_DONE;
} }
@ -1036,7 +1037,7 @@ readBtMessage( tr_peermsgs * msgs, struct evbuffer * inbuf )
break; break;
} }
case BT_PIECE: { case BT_PIECE:
dbgmsg( msgs, "got a Piece!" ); dbgmsg( msgs, "got a Piece!" );
assert( msgs->blockToUs.length == 0 ); assert( msgs->blockToUs.length == 0 );
tr_peerIoReadUint32( msgs->io, inbuf, &msgs->blockToUs.index ); tr_peerIoReadUint32( msgs->io, inbuf, &msgs->blockToUs.index );
@ -1046,14 +1047,13 @@ readBtMessage( tr_peermsgs * msgs, struct evbuffer * inbuf )
msgs->state = msgs->blockToUs.length ? READING_BT_PIECE : AWAITING_BT_LENGTH; msgs->state = msgs->blockToUs.length ? READING_BT_PIECE : AWAITING_BT_LENGTH;
return READ_AGAIN; return READ_AGAIN;
break; break;
}
case BT_PORT: { case BT_PORT:
dbgmsg( msgs, "Got a BT_PORT" ); dbgmsg( msgs, "Got a BT_PORT" );
tr_peerIoReadUint16( msgs->io, inbuf, &msgs->info->port ); tr_peerIoReadUint16( msgs->io, inbuf, &msgs->info->port );
break; break;
}
#if 0
case BT_SUGGEST: { case BT_SUGGEST: {
/* FIXME(tiennou) */ /* FIXME(tiennou) */
uint32_t index; uint32_t index;
@ -1089,6 +1089,7 @@ readBtMessage( tr_peermsgs * msgs, struct evbuffer * inbuf )
tr_bitfieldAdd( msgs->clientAllowedPieces, ui32 ); tr_bitfieldAdd( msgs->clientAllowedPieces, ui32 );
break; break;
} }
#endif
case BT_LTEP: case BT_LTEP:
dbgmsg( msgs, "Got a BT_LTEP" ); dbgmsg( msgs, "Got a BT_LTEP" );
@ -1305,7 +1306,7 @@ readBtPiece( tr_peermsgs * msgs, struct evbuffer * inbuf )
msgs->blockToUs.index, msgs->blockToUs.index,
msgs->blockToUs.offset, msgs->blockToUs.offset,
EVBUFFER_LENGTH( msgs->inBlock ) ); EVBUFFER_LENGTH( msgs->inBlock ) );
evbuffer_drain( msgs->inBlock, ~0 ); evbuffer_drain( msgs->inBlock, EVBUFFER_LENGTH( msgs->inBlock ) );
msgs->state = AWAITING_BT_LENGTH; msgs->state = AWAITING_BT_LENGTH;
} }