summaryrefslogtreecommitdiff
path: root/opentracker.c
diff options
context:
space:
mode:
authorerdgeist <>2009-01-03 03:25:37 +0000
committererdgeist <>2009-01-03 03:25:37 +0000
commit8bdc0d73f6f0bcaf83b7fb3d39e79e8fa4e6050d (patch)
treea75f8eed836bbea20992f92093160cd345c29f60 /opentracker.c
parent2df09905f5540fee096d48a92cb0c42558498a12 (diff)
Make opentracker ANSI C again.
Diffstat (limited to 'opentracker.c')
-rw-r--r--opentracker.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/opentracker.c b/opentracker.c
index 993877a..bce5be0 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -97,9 +97,9 @@ static void handle_dead( const int64 socket ) {
97 struct http_data* h=io_getcookie( socket ); 97 struct http_data* h=io_getcookie( socket );
98 if( h ) { 98 if( h ) {
99 if( h->flag & STRUCT_HTTP_FLAG_IOB_USED ) 99 if( h->flag & STRUCT_HTTP_FLAG_IOB_USED )
100 iob_reset( &h->batch ); 100 iob_reset( &h->data.batch );
101 if( h->flag & STRUCT_HTTP_FLAG_ARRAY_USED ) 101 if( h->flag & STRUCT_HTTP_FLAG_ARRAY_USED )
102 array_reset( &h->request ); 102 array_reset( &h->data.request );
103 if( h->flag & STRUCT_HTTP_FLAG_WAITINGFORTASK ) 103 if( h->flag & STRUCT_HTTP_FLAG_WAITINGFORTASK )
104 mutex_workqueue_canceltask( socket ); 104 mutex_workqueue_canceltask( socket );
105 free( h ); 105 free( h );
@@ -117,32 +117,32 @@ static ssize_t handle_read( const int64 clientsocket ) {
117 } 117 }
118 118
119 /* If we get the whole request in one packet, handle it without copying */ 119 /* If we get the whole request in one packet, handle it without copying */
120 if( !array_start( &h->request ) ) { 120 if( !array_start( &h->data.request ) ) {
121 if( memchr( static_inbuf, '\n', l ) ) 121 if( memchr( static_inbuf, '\n', l ) )
122 return http_handle_request( clientsocket, static_inbuf, l ); 122 return http_handle_request( clientsocket, static_inbuf, l );
123 h->flag |= STRUCT_HTTP_FLAG_ARRAY_USED; 123 h->flag |= STRUCT_HTTP_FLAG_ARRAY_USED;
124 array_catb( &h->request, static_inbuf, l ); 124 array_catb( &h->data.request, static_inbuf, l );
125 return 0; 125 return 0;
126 } 126 }
127 127
128 h->flag |= STRUCT_HTTP_FLAG_ARRAY_USED; 128 h->flag |= STRUCT_HTTP_FLAG_ARRAY_USED;
129 array_catb( &h->request, static_inbuf, l ); 129 array_catb( &h->data.request, static_inbuf, l );
130 130
131 if( array_failed( &h->request ) ) 131 if( array_failed( &h->data.request ) )
132 return http_issue_error( clientsocket, CODE_HTTPERROR_500 ); 132 return http_issue_error( clientsocket, CODE_HTTPERROR_500 );
133 133
134 if( array_bytes( &h->request ) > 8192 ) 134 if( array_bytes( &h->data.request ) > 8192 )
135 return http_issue_error( clientsocket, CODE_HTTPERROR_500 ); 135 return http_issue_error( clientsocket, CODE_HTTPERROR_500 );
136 136
137 if( memchr( array_start( &h->request ), '\n', array_bytes( &h->request ) ) ) 137 if( memchr( array_start( &h->data.request ), '\n', array_bytes( &h->data.request ) ) )
138 return http_handle_request( clientsocket, array_start( &h->request ), array_bytes( &h->request ) ); 138 return http_handle_request( clientsocket, array_start( &h->data.request ), array_bytes( &h->data.request ) );
139 139
140 return 0; 140 return 0;
141} 141}
142 142
143static void handle_write( const int64 clientsocket ) { 143static void handle_write( const int64 clientsocket ) {
144 struct http_data* h=io_getcookie( clientsocket ); 144 struct http_data* h=io_getcookie( clientsocket );
145 if( !h || ( iob_send( clientsocket, &h->batch ) <= 0 ) ) 145 if( !h || ( iob_send( clientsocket, &h->data.batch ) <= 0 ) )
146 handle_dead( clientsocket ); 146 handle_dead( clientsocket );
147} 147}
148 148