Changeset 2038
- Timestamp:
- Jun 10, 2007, 10:56:18 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/daemon/server.c
r1926 r2038 63 63 static void doread ( struct bufferevent *, void * ); 64 64 static int queuemsg ( struct client *, uint8_t *, size_t ); 65 static voidmsgresp ( struct client *, int64_t, enum ipc_msg );65 static int msgresp ( struct client *, int64_t, enum ipc_msg ); 66 66 static void defmsg ( enum ipc_msg, benc_val_t *, int64_t, void * ); 67 67 static void noopmsg ( enum ipc_msg, benc_val_t *, int64_t, void * ); … … 389 389 } 390 390 391 void 391 int 392 392 msgresp( struct client * client, int64_t tag, enum ipc_msg id ) 393 393 { 394 394 uint8_t * buf; 395 395 size_t buflen; 396 int ret; 396 397 397 398 if( 0 >= tag ) 398 399 { 399 return ;400 return 0; 400 401 } 401 402 402 403 buf = ipc_mkempty( &client->ipc, &buflen, id, tag ); 403 queuemsg( client, buf, buflen );404 ret = queuemsg( client, buf, buflen ); 404 405 free( buf ); 406 407 return ret; 405 408 } 406 409 … … 435 438 if( NULL == val || TYPE_LIST != val->type ) 436 439 { 437 msgresp( client, tag, IPC_MSG_ NOTSUP);440 msgresp( client, tag, IPC_MSG_BAD ); 438 441 return; 439 442 } … … 488 491 if( NULL == dict || TYPE_DICT != dict->type ) 489 492 { 490 msgresp( client, tag, IPC_MSG_ NOTSUP);493 msgresp( client, tag, IPC_MSG_BAD ); 491 494 return; 492 495 } … … 509 512 if( NULL == val || TYPE_STR != val->type ) 510 513 { 511 msgresp( client, tag, IPC_MSG_ NOTSUP);514 msgresp( client, tag, IPC_MSG_BAD ); 512 515 return; 513 516 } … … 568 571 if( NULL == val || TYPE_INT != val->type ) 569 572 { 570 msgresp( client, tag, IPC_MSG_ NOTSUP);573 msgresp( client, tag, IPC_MSG_BAD ); 571 574 return; 572 575 } … … 608 611 if( NULL == val || TYPE_STR != val->type ) 609 612 { 610 msgresp( client, tag, IPC_MSG_ NOTSUP);613 msgresp( client, tag, IPC_MSG_BAD ); 611 614 return; 612 615 } … … 673 676 if( NULL == val || TYPE_LIST != val->type ) 674 677 { 675 msgresp( client, tag, IPC_MSG_ NOTSUP);678 msgresp( client, tag, IPC_MSG_BAD ); 676 679 tr_bencFree( &pk ); 677 680 return; … … 695 698 if( NULL == val || TYPE_DICT != val->type ) 696 699 { 697 msgresp( client, tag, IPC_MSG_ NOTSUP);700 msgresp( client, tag, IPC_MSG_BAD ); 698 701 tr_bencFree( &pk ); 699 702 return; … … 704 707 NULL == idlist || TYPE_LIST != idlist->type ) 705 708 { 706 msgresp( client, tag, IPC_MSG_ NOTSUP);709 msgresp( client, tag, IPC_MSG_BAD ); 707 710 tr_bencFree( &pk ); 708 711 return; … … 814 817 if( NULL == val || TYPE_LIST != val->type ) 815 818 { 816 msgresp( client, tag, IPC_MSG_ NOTSUP);819 msgresp( client, tag, IPC_MSG_BAD ); 817 820 return; 818 821 } … … 844 847 if( NULL == val || TYPE_LIST != val->type ) 845 848 { 846 msgresp( client, tag, IPC_MSG_ NOTSUP);849 msgresp( client, tag, IPC_MSG_BAD ); 847 850 return; 848 851 } … … 863 866 { 864 867 tr_bencFree( &pk ); 865 msgresp( client, tag, IPC_MSG_ NOTSUP);868 msgresp( client, tag, IPC_MSG_BAD ); 866 869 return; 867 870 } … … 946 949 if( NULL == val || TYPE_LIST != val->type ) 947 950 { 948 msgresp( client, tag, IPC_MSG_ NOTSUP);951 msgresp( client, tag, IPC_MSG_BAD ); 949 952 return; 950 953 } … … 972 975 { 973 976 tr_bencFree( &pk ); 974 msgresp( client, tag, IPC_MSG_ NOTSUP);977 msgresp( client, tag, IPC_MSG_BAD ); 975 978 return; 976 979 } 977 980 found = ipc_msgid( &client->ipc, name->val.s.s ); 978 if( IPC__MSG_COUNT == found )981 if( IPC__MSG_COUNT == found || !ipc_ishandled( &client->ipc, found ) ) 979 982 { 980 983 continue; -
trunk/libtransmission/ipcparse.c
r2031 r2038 1127 1127 1128 1128 int 1129 ipc_ishandled( struct ipc_info * info, enum ipc_msg id ) 1130 { 1131 struct msgfunc key; 1132 1133 assert( MSGVALID( id ) ); 1134 1135 bzero( &key, sizeof key ); 1136 key.id = id; 1137 return ( NULL != RB_FIND( functree, &info->funcs->msgs, &key ) ); 1138 } 1139 1140 int 1129 1141 ipc_havetags( struct ipc_info * info ) 1130 1142 { -
trunk/libtransmission/ipcparse.h
r2031 r2038 165 165 int ipc_havemsg ( struct ipc_info *, enum ipc_msg ); 166 166 enum ipc_msg ipc_msgid ( struct ipc_info *, const char * ); 167 int ipc_ishandled( struct ipc_info *, enum ipc_msg ); 167 168 int ipc_havetags ( struct ipc_info * ); 168 169 int ipc_infotypes( enum ipc_msg, benc_val_t * );
Note: See TracChangeset
for help on using the changeset viewer.