summaryrefslogtreecommitdiff
path: root/opentracker.c
diff options
context:
space:
mode:
Diffstat (limited to 'opentracker.c')
-rw-r--r--opentracker.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/opentracker.c b/opentracker.c
index f9dc48b..0d4f2b5 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -154,7 +154,7 @@ static void senddata( const int64 s, char *buffer, size_t size ) {
154 array_reset( &h->request ); 154 array_reset( &h->request );
155 155
156 written_size = write( s, buffer, size ); 156 written_size = write( s, buffer, size );
157 if( ( written_size < 0 ) || ( written_size == size ) ) { 157 if( ( written_size < 0 ) || ( (size_t)written_size == size ) ) {
158 free( h ); io_close( s ); 158 free( h ); io_close( s );
159 } else { 159 } else {
160 char * outbuf = malloc( size - written_size ); 160 char * outbuf = malloc( size - written_size );
@@ -594,15 +594,15 @@ static void handle_timeouted( void ) {
594} 594}
595 595
596static void handle_udp4( int64 serversocket ) { 596static void handle_udp4( int64 serversocket ) {
597 ot_peer peer; 597 ot_peer peer;
598 ot_torrent *torrent; 598 ot_torrent *torrent;
599 ot_hash *hash = NULL; 599 ot_hash *hash = NULL;
600 char remoteip[4]; 600 char remoteip[4];
601 unsigned long *inpacket = (unsigned long*)static_inbuf; 601 ot_dword *inpacket = (ot_dword*)static_inbuf;
602 unsigned long *outpacket = (unsigned long*)static_outbuf; 602 ot_dword *outpacket = (ot_dword*)static_outbuf;
603 unsigned long numwant, left, event; 603 ot_dword numwant, left, event;
604 uint16 port, remoteport; 604 ot_word port, remoteport;
605 size_t r, r_out; 605 size_t r, r_out;
606 606
607 r = socket_recv4( serversocket, static_inbuf, 8192, remoteip, &remoteport); 607 r = socket_recv4( serversocket, static_inbuf, 8192, remoteip, &remoteport);
608 608
@@ -627,8 +627,9 @@ static void handle_udp4( int64 serversocket ) {
627 numwant = 200; 627 numwant = 200;
628 /* We do only want to know, if it is zero */ 628 /* We do only want to know, if it is zero */
629 left = inpacket[64/4] | inpacket[68/4]; 629 left = inpacket[64/4] | inpacket[68/4];
630
630 event = ntohl( inpacket[80/4] ); 631 event = ntohl( inpacket[80/4] );
631 port = *(unsigned short*)( static_inbuf + 96 ); 632 port = *(ot_word*)( static_inbuf + 96 );
632 hash = (ot_hash*)( static_inbuf + 16 ); 633 hash = (ot_hash*)( static_inbuf + 16 );
633 634
634 OT_SETIP( &peer, remoteip ); 635 OT_SETIP( &peer, remoteip );