summaryrefslogtreecommitdiff
path: root/opentracker.c
diff options
context:
space:
mode:
authorerdgeist <>2006-12-16 18:46:11 +0000
committererdgeist <>2006-12-16 18:46:11 +0000
commitf406961fe0dc2945b2eaeaefac5e9fd7d087fde8 (patch)
tree38759e9f87d2d94af8ae4a7ccfe86b08918ac7a9 /opentracker.c
parente471e2c20bc3aa2fecaac2f4cd1b9a4be89413f5 (diff)
Try early answers
Diffstat (limited to 'opentracker.c')
-rw-r--r--opentracker.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/opentracker.c b/opentracker.c
index 560e9a1..342acf7 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -94,7 +94,7 @@ const char* http_header(struct http_data* r,const char* h)
94 94
95void httpresponse(struct http_data* h,int64 s) 95void httpresponse(struct http_data* h,int64 s)
96{ 96{
97 char *c, *d, *data, *reply = NULL; 97 char *c, *data, *reply = NULL;
98 ot_peer peer; 98 ot_peer peer;
99 ot_torrent *torrent; 99 ot_torrent *torrent;
100 ot_hash *hash = NULL; 100 ot_hash *hash = NULL;
@@ -113,10 +113,10 @@ e400:
113 } 113 }
114 114
115 c+=4; 115 c+=4;
116 for (d=c; *d!=' '&&*d!='\t'&&*d!='\n'&&*d!='\r'; ++d) ; 116 for (data=c; *data!=' '&&*data!='\t'&&*data!='\n'&&*data!='\r'; ++data) ;
117 117
118 if (*d!=' ') goto e400; 118 if (*data!=' ') goto e400;
119 *d=0; 119 *data=0;
120 if (c[0]!='/') goto e404; 120 if (c[0]!='/') goto e404;
121 while (*c=='/') ++c; 121 while (*c=='/') ++c;
122 122
@@ -291,7 +291,21 @@ e404:
291 291
292bailout: 292bailout:
293 io_dontwantread(s); 293 io_dontwantread(s);
294 shutdown(s, SHUT_RD );
294 io_wantwrite(s); 295 io_wantwrite(s);
296
297 reply_size=iob_send(s,&h->iob);
298 if (reply_size==-1) {
299 io_eagain(s);
300 } else
301 if ((reply_size<=0)||(h->iob.bytesleft==0))
302 {
303 array_reset(&h->r);
304 iob_reset(&h->iob);
305 free(h);
306 shutdown(s, SHUT_RDWR);
307 io_close(s);
308 }
295} 309}
296 310
297void graceful( int s ) { 311void graceful( int s ) {