Changeset 6548
- Timestamp:
- Aug 16, 2008, 5:11:28 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-msgs.c
r6525 r6548 389 389 tr_peerIoWriteUint32( io, out, req->length ); 390 390 pokeBatchPeriod( msgs, HIGH_PRIORITY_INTERVAL_SECS ); 391 dbgmsg( msgs, "outMessage size is now %d", (int)EVBUFFER_LENGTH(out) ); 391 392 } 392 393 … … 404 405 tr_peerIoWriteUint32( io, out, req->length ); 405 406 pokeBatchPeriod( msgs, IMMEDIATE_PRIORITY_INTERVAL_SECS ); 407 dbgmsg( msgs, "outMessage size is now %d", (int)EVBUFFER_LENGTH(out) ); 406 408 } 407 409 … … 417 419 tr_peerIoWriteUint32( io, out, index ); 418 420 pokeBatchPeriod( msgs, LOW_PRIORITY_INTERVAL_SECS ); 421 dbgmsg( msgs, "outMessage size is now %d", (int)EVBUFFER_LENGTH(out) ); 419 422 } 420 423 … … 429 432 tr_peerIoWriteUint8 ( io, out, choke ? BT_CHOKE : BT_UNCHOKE ); 430 433 pokeBatchPeriod( msgs, IMMEDIATE_PRIORITY_INTERVAL_SECS ); 434 dbgmsg( msgs, "outMessage size is now %d", (int)EVBUFFER_LENGTH(out) ); 431 435 } 432 436 … … 552 556 sendInterest( tr_peermsgs * msgs, int weAreInterested ) 553 557 { 558 struct evbuffer * out = msgs->outMessages; 559 554 560 assert( msgs ); 555 561 assert( weAreInterested==0 || weAreInterested==1 ); 556 562 557 563 msgs->info->clientIsInterested = weAreInterested; 558 dbgmsg( msgs, "Sending %s", 559 weAreInterested ? "Interested" : "Not Interested"); 560 561 tr_peerIoWriteUint32( msgs->io, msgs->outMessages, sizeof(uint8_t) ); 562 tr_peerIoWriteUint8 ( msgs->io, msgs->outMessages, 563 weAreInterested ? BT_INTERESTED : BT_NOT_INTERESTED ); 564 dbgmsg( msgs, "Sending %s", weAreInterested ? "Interested" : "Not Interested"); 565 tr_peerIoWriteUint32( msgs->io, out, sizeof(uint8_t) ); 566 tr_peerIoWriteUint8 ( msgs->io, out, weAreInterested ? BT_INTERESTED : BT_NOT_INTERESTED ); 564 567 pokeBatchPeriod( msgs, HIGH_PRIORITY_INTERVAL_SECS ); 568 dbgmsg( msgs, "outMessage size is now %d", (int)EVBUFFER_LENGTH(out) ); 565 569 } 566 570 … … 656 660 if( tr_peerIoSupportsFEXT( msgs->io ) ) 657 661 { 662 struct evbuffer * out = msgs->outMessages; 658 663 const uint32_t len = sizeof(uint8_t) + 3 * sizeof(uint32_t); 659 tr_peerIoWriteUint32( msgs->io, msgs->outMessages, len ); 660 tr_peerIoWriteUint8( msgs->io, msgs->outMessages, BT_REJECT ); 661 tr_peerIoWriteUint32( msgs->io, msgs->outMessages, pieceIndex ); 662 tr_peerIoWriteUint32( msgs->io, msgs->outMessages, offset ); 663 tr_peerIoWriteUint32( msgs->io, msgs->outMessages, length ); 664 dbgmsg( msgs, "sending fast reject %u:%u->%u", pieceIndex, offset, length ); 665 tr_peerIoWriteUint32( msgs->io, out, len ); 666 tr_peerIoWriteUint8( msgs->io, out, BT_REJECT ); 667 tr_peerIoWriteUint32( msgs->io, out, pieceIndex ); 668 tr_peerIoWriteUint32( msgs->io, out, offset ); 669 tr_peerIoWriteUint32( msgs->io, out, length ); 664 670 pokeBatchPeriod( msgs, LOW_PRIORITY_INTERVAL_SECS ); 671 dbgmsg( msgs, "outMessage size is now %d", (int)EVBUFFER_LENGTH(out) ); 665 672 } 666 673 } … … 689 696 if( tr_peerIoSupportsFEXT( msgs->io ) ) 690 697 { 691 tr_peerIoWriteUint32( msgs->io, msgs->outMessages, sizeof(uint8_t) + sizeof(uint32_t) ); 692 tr_peerIoWriteUint8( msgs->io, msgs->outMessages, BT_ALLOWED_FAST ); 693 tr_peerIoWriteUint32( msgs->io, msgs->outMessages, pieceIndex ); 698 struct evbuffer * out = msgs->outMessages; 699 dbgmsg( msgs, "sending fast allowed" ); 700 tr_peerIoWriteUint32( msgs->io, out, sizeof(uint8_t) + sizeof(uint32_t) ); 701 tr_peerIoWriteUint8( msgs->io, out, BT_ALLOWED_FAST ); 702 tr_peerIoWriteUint32( msgs->io, out, pieceIndex ); 694 703 pokeBatchPeriod( msgs, LOW_PRIORITY_INTERVAL_SECS ); 704 dbgmsg( msgs, "outMessage size is now %d", (int)EVBUFFER_LENGTH(out) ); 695 705 } 696 706 } … … 925 935 int len; 926 936 int pex; 927 struct evbuffer * out buf;937 struct evbuffer * out = msgs->outMessages; 928 938 929 939 if( msgs->clientSentLtepHandshake ) 930 940 return; 931 941 932 outbuf = evbuffer_new( );933 942 dbgmsg( msgs, "sending an ltep handshake" ); 934 943 msgs->clientSentLtepHandshake = 1; … … 951 960 buf = tr_bencSave( &val, &len ); 952 961 953 tr_peerIoWriteUint32( msgs->io, outbuf, 2*sizeof(uint8_t) + len ); 954 tr_peerIoWriteUint8 ( msgs->io, outbuf, BT_LTEP ); 955 tr_peerIoWriteUint8 ( msgs->io, outbuf, LTEP_HANDSHAKE ); 956 tr_peerIoWriteBytes ( msgs->io, outbuf, buf, len ); 957 958 tr_peerIoWriteBuf( msgs->io, outbuf ); 959 960 dbgmsg( msgs, "here is the ltep handshake we sent [%*.*s]", len, len, buf ); 962 tr_peerIoWriteUint32( msgs->io, out, 2*sizeof(uint8_t) + len ); 963 tr_peerIoWriteUint8 ( msgs->io, out, BT_LTEP ); 964 tr_peerIoWriteUint8 ( msgs->io, out, LTEP_HANDSHAKE ); 965 tr_peerIoWriteBytes ( msgs->io, out, buf, len ); 966 pokeBatchPeriod( msgs, IMMEDIATE_PRIORITY_INTERVAL_SECS ); 967 dbgmsg( msgs, "outMessage size is now %d", (int)EVBUFFER_LENGTH(out) ); 961 968 962 969 /* cleanup */ 963 970 tr_bencFree( &val ); 964 971 tr_free( buf ); 965 evbuffer_free( outbuf );966 972 } 967 973 … … 1753 1759 tr_peerIoWriteBytes ( msgs->io, out, bitfield->bits, bitfield->byteCount ); 1754 1760 pokeBatchPeriod( msgs, IMMEDIATE_PRIORITY_INTERVAL_SECS ); 1761 dbgmsg( msgs, "outMessage size is now %d", (int)EVBUFFER_LENGTH(out) ); 1755 1762 } 1756 1763 … … 1820 1827 char * benc; 1821 1828 int bencLen; 1829 struct evbuffer * out = msgs->outMessages; 1822 1830 1823 1831 /* build the diffs */ … … 1872 1880 /* write the pex message */ 1873 1881 benc = tr_bencSave( &val, &bencLen ); 1874 tr_peerIoWriteUint32( msgs->io, msgs->outMessages, 2*sizeof(uint8_t) + bencLen );1875 tr_peerIoWriteUint8 ( msgs->io, msgs->outMessages, BT_LTEP );1876 tr_peerIoWriteUint8 ( msgs->io, msgs->outMessages, msgs->ut_pex_id );1877 tr_peerIoWriteBytes ( msgs->io, msgs->outMessages, benc, bencLen );1882 tr_peerIoWriteUint32( msgs->io, out, 2*sizeof(uint8_t) + bencLen ); 1883 tr_peerIoWriteUint8 ( msgs->io, out, BT_LTEP ); 1884 tr_peerIoWriteUint8 ( msgs->io, out, msgs->ut_pex_id ); 1885 tr_peerIoWriteBytes ( msgs->io, out, benc, bencLen ); 1878 1886 pokeBatchPeriod( msgs, IMMEDIATE_PRIORITY_INTERVAL_SECS ); 1887 dbgmsg( msgs, "outMessage size is now %d", (int)EVBUFFER_LENGTH(out) ); 1879 1888 1880 1889 /* cleanup */
Note: See TracChangeset
for help on using the changeset viewer.