Changeset 5766
- Timestamp:
- May 7, 2008, 11:57:23 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/daemon/server.c
r5579 r5766 39 39 #include <libtransmission/bencode.h> 40 40 #include <libtransmission/ipcparse.h> 41 #include <libtransmission/utils.h> /* tr_free */ 41 42 42 43 #include "bsdtree.h" … … 388 389 } 389 390 390 int391 static int 391 392 queuemsg( struct client * client, uint8_t * buf, size_t buflen ) 392 393 { … … 417 418 } 418 419 420 static int 421 queuepkmsg( struct client * client, tr_benc * pk ) 422 { 423 size_t buflen; 424 uint8_t * buf = ipc_serialize( pk, &buflen ); 425 int ret = queuemsg( client, buf, buflen ); 426 tr_free( buf ); 427 return ret; 428 } 429 419 430 int 420 431 msgresp( struct client * client, int64_t tag, enum ipc_msg id ) … … 460 471 benc_val_t pk, * added; 461 472 int ii, tor; 462 size_t buflen;463 uint8_t * buf;464 473 465 474 if( !tr_bencIsList( val ) ) … … 497 506 } 498 507 499 buf = ipc_serialize( &pk, &buflen);508 queuepkmsg( client, &pk ); 500 509 tr_bencFree( &pk ); 501 queuemsg( client, buf, buflen );502 free( buf );503 510 } 504 511 … … 509 516 benc_val_t * val, pk; 510 517 int tor, start; 511 size_t buflen;512 uint8_t * buf;513 518 const char * dir; 514 519 … … 558 563 return; 559 564 } 560 buf = ipc_serialize( &pk, &buflen ); 565 566 queuepkmsg( client, &pk ); 561 567 tr_bencFree( &pk ); 562 queuemsg( client, buf, buflen );563 free( buf );564 568 } 565 569 else … … 658 662 { 659 663 struct client * client = arg; 660 uint8_t * buf;661 size_t buflen;662 664 benc_val_t pk, * pkinf, * typelist, * idlist, * idval; 663 665 int all, types, ii, tor; … … 755 757 } 756 758 757 /* generate packet data and send it */ 758 buf = ipc_serialize( &pk, &buflen ); 759 queuepkmsg( client, &pk ); 759 760 tr_bencFree( &pk ); 760 queuemsg( client, buf, buflen );761 free( buf );762 761 } 763 762 … … 854 853 { 855 854 struct client * client = arg; 856 uint8_t * buf;857 size_t buflen;858 855 int ii; 859 856 benc_val_t * hash, pk, * pkinf; … … 897 894 } 898 895 899 buf = ipc_serialize( &pk, &buflen);896 queuepkmsg( client, &pk ); 900 897 tr_bencFree( &pk ); 901 queuemsg( client, buf, buflen );902 free( buf );903 898 } 904 899 … … 963 958 { 964 959 struct client * client = arg; 965 uint8_t * buf;966 size_t buflen;967 960 int ii; 968 961 benc_val_t pk, *pkval; … … 1009 1002 } 1010 1003 1011 buf = ipc_serialize( &pk, &buflen);1004 queuepkmsg( client, &pk ); 1012 1005 tr_bencFree( &pk ); 1013 queuemsg( client, buf, buflen ); 1014 free( buf ); 1015 } 1006 }
Note: See TracChangeset
for help on using the changeset viewer.