diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-11 17:20:00 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-11 17:20:00 +0000 |
commit | f7996f3b700a22797565e9aa57e251e6e3ac1e4d (patch) | |
tree | af4e797eef0a65f4e3dba94b325da0ec08452d36 /networking/fakeidentd.c | |
parent | 3821fb13ea404d243115ff8ec161273b62826513 (diff) | |
download | busybox-w32-f7996f3b700a22797565e9aa57e251e6e3ac1e4d.tar.gz busybox-w32-f7996f3b700a22797565e9aa57e251e6e3ac1e4d.tar.bz2 busybox-w32-f7996f3b700a22797565e9aa57e251e6e3ac1e4d.zip |
Trailing whitespace removal over entire tree
Diffstat (limited to 'networking/fakeidentd.c')
-rw-r--r-- | networking/fakeidentd.c | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/networking/fakeidentd.c b/networking/fakeidentd.c index 8967a7a38..7eac48065 100644 --- a/networking/fakeidentd.c +++ b/networking/fakeidentd.c | |||
@@ -240,68 +240,68 @@ int fakeidentd_main(int argc, char **argv) | |||
240 | 240 | ||
241 | /* main loop where we process all events and never exit */ | 241 | /* main loop where we process all events and never exit */ |
242 | while (1) { | 242 | while (1) { |
243 | fd_set rfds = G.readfds; | 243 | fd_set rfds = G.readfds; |
244 | struct timeval tv = { 15, 0 }; | 244 | struct timeval tv = { 15, 0 }; |
245 | int i; | 245 | int i; |
246 | int tim = time(NULL); | 246 | int tim = time(NULL); |
247 | 247 | ||
248 | select(G.conncnt + FCS, &rfds, NULL, NULL, G.conncnt? &tv: NULL); | 248 | select(G.conncnt + FCS, &rfds, NULL, NULL, G.conncnt? &tv: NULL); |
249 | 249 | ||
250 | for (i = G.conncnt - 1; i >= 0; i--) { | 250 | for (i = G.conncnt - 1; i >= 0; i--) { |
251 | int s = i + FCS; | 251 | int s = i + FCS; |
252 | 252 | ||
253 | if (FD_ISSET(s, &rfds)) { | 253 | if (FD_ISSET(s, &rfds)) { |
254 | char *buf = conns[i].buf; | 254 | char *buf = conns[i].buf; |
255 | unsigned int len = conns[i].len; | 255 | unsigned int len = conns[i].len; |
256 | unsigned int l; | 256 | unsigned int l; |
257 | 257 | ||
258 | if ((l = read(s, buf + len, sizeof(conns[0].buf) - len)) > 0) { | 258 | if ((l = read(s, buf + len, sizeof(conns[0].buf) - len)) > 0) { |
259 | if (checkInput(buf, len, l)) { | 259 | if (checkInput(buf, len, l)) { |
260 | reply(s, buf); | 260 | reply(s, buf); |
261 | goto deleteconn; | 261 | goto deleteconn; |
262 | } else if (len + l >= sizeof(conns[0].buf)) { | 262 | } else if (len + l >= sizeof(conns[0].buf)) { |
263 | replyError(s, "X-INVALID-REQUEST"); | 263 | replyError(s, "X-INVALID-REQUEST"); |
264 | goto deleteconn; | 264 | goto deleteconn; |
265 | } else { | ||
266 | conns[i].len += l; | ||
267 | } | ||
265 | } else { | 268 | } else { |
266 | conns[i].len += l; | 269 | goto deleteconn; |
267 | } | 270 | } |
268 | } else { | ||
269 | goto deleteconn; | ||
270 | } | ||
271 | 271 | ||
272 | conns[i].lasttime = tim; | 272 | conns[i].lasttime = tim; |
273 | continue; | 273 | continue; |
274 | 274 | ||
275 | deleteconn: | 275 | deleteconn: |
276 | deleteConn(s); | ||
277 | } else { | ||
278 | /* implement as time_after() in linux kernel sources ... */ | ||
279 | if (conns[i].lasttime + MAXIDLETIME <= tim) { | ||
280 | replyError(s, "X-TIMEOUT"); | ||
281 | deleteConn(s); | 276 | deleteConn(s); |
277 | } else { | ||
278 | /* implement as time_after() in linux kernel sources ... */ | ||
279 | if (conns[i].lasttime + MAXIDLETIME <= tim) { | ||
280 | replyError(s, "X-TIMEOUT"); | ||
281 | deleteConn(s); | ||
282 | } | ||
282 | } | 283 | } |
283 | } | 284 | } |
284 | } | ||
285 | 285 | ||
286 | if (FD_ISSET(0, &rfds)) { | 286 | if (FD_ISSET(0, &rfds)) { |
287 | int s = accept(0, NULL, 0); | 287 | int s = accept(0, NULL, 0); |
288 | 288 | ||
289 | if (s < 0) { | 289 | if (s < 0) { |
290 | if (errno != EINTR) /* EINTR */ | 290 | if (errno != EINTR) /* EINTR */ |
291 | bb_perror_msg("accept"); | 291 | bb_perror_msg("accept"); |
292 | } else { | 292 | } else { |
293 | if (G.conncnt == MAXCONNS) | 293 | if (G.conncnt == MAXCONNS) |
294 | i = closeOldest(); | 294 | i = closeOldest(); |
295 | else | 295 | else |
296 | i = G.conncnt++; | 296 | i = G.conncnt++; |
297 | 297 | ||
298 | movefd(s, i + FCS); /* move if not already there */ | 298 | movefd(s, i + FCS); /* move if not already there */ |
299 | FD_SET(i + FCS, &G.readfds); | 299 | FD_SET(i + FCS, &G.readfds); |
300 | 300 | ||
301 | conns[i].len = 0; | 301 | conns[i].len = 0; |
302 | conns[i].lasttime = time(NULL); | 302 | conns[i].lasttime = time(NULL); |
303 | } | ||
303 | } | 304 | } |
304 | } | ||
305 | } /* end of while (1) */ | 305 | } /* end of while (1) */ |
306 | 306 | ||
307 | return 0; | 307 | return 0; |