ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/loop.c
(Generate patch)

Comparing deliantra/server/socket/loop.c (file contents):
Revision 1.4 by root, Mon Apr 17 08:18:05 2006 UTC vs.
Revision 1.5 by root, Tue Apr 18 20:05:42 2006 UTC

1 1
2/* 2/*
3 * static char *rcsid_loop_c = 3 * static char *rcsid_loop_c =
4 * "$Id: loop.c,v 1.4 2006/04/17 08:18:05 root Exp $"; 4 * "$Id: loop.c,v 1.5 2006/04/18 20:05:42 root Exp $";
5 */ 5 */
6 6
7/* 7/*
8 CrossFire, A Multiplayer game for X-windows 8 CrossFire, A Multiplayer game for X-windows
9 9
383 ns->inbuf.buf[ns->inbuf.len]='\0'; /* Terminate buffer - useful for string data */ 383 ns->inbuf.buf[ns->inbuf.len]='\0'; /* Terminate buffer - useful for string data */
384 for (i=0; nscommands[i].cmdname !=NULL; i++) { 384 for (i=0; nscommands[i].cmdname !=NULL; i++) {
385 if (strcmp((char*)ns->inbuf.buf+2,nscommands[i].cmdname)==0) { 385 if (strcmp((char*)ns->inbuf.buf+2,nscommands[i].cmdname)==0) {
386 nscommands[i].cmdproc((char*)data,len,ns); 386 nscommands[i].cmdproc((char*)data,len,ns);
387 ns->inbuf.len=0; 387 ns->inbuf.len=0;
388 continue; 388 goto next_packet;
389 } 389 }
390 } 390 }
391 /* Player must be in the playing state or the flag on the 391 /* Player must be in the playing state or the flag on the
392 * the command must be zero for the user to use the command - 392 * the command must be zero for the user to use the command -
393 * otherwise, a player cam save, be in the play_again state, and 393 * otherwise, a player cam save, be in the play_again state, and
398 if (pl) for (i=0; plcommands[i].cmdname !=NULL; i++) { 398 if (pl) for (i=0; plcommands[i].cmdname !=NULL; i++) {
399 if (strcmp((char*)ns->inbuf.buf+2,plcommands[i].cmdname)==0) { 399 if (strcmp((char*)ns->inbuf.buf+2,plcommands[i].cmdname)==0) {
400 if (pl->state == ST_PLAYING || plcommands[i].flag == 0) 400 if (pl->state == ST_PLAYING || plcommands[i].flag == 0)
401 plcommands[i].cmdproc((char*)data,len,pl); 401 plcommands[i].cmdproc((char*)data,len,pl);
402 ns->inbuf.len=0; 402 ns->inbuf.len=0;
403 continue; 403 goto next_packet;
404 } 404 }
405 } 405 }
406 /* If we get here, we didn't find a valid command. Logging 406 /* If we get here, we didn't find a valid command. Logging
407 * this might be questionable, because a broken client/malicious 407 * this might be questionable, because a broken client/malicious
408 * user could certainly send a whole bunch of invalid commands. 408 * user could certainly send a whole bunch of invalid commands.
409 */ 409 */
410 LOG(llevDebug,"Bad command from client (%s)\n",ns->inbuf.buf+2); 410 LOG(llevDebug,"Bad command from client (%s)\n",ns->inbuf.buf+2);
411 next_packet:
412 ;
411 } 413 }
412} 414}
413 415
414 416
415/***************************************************************************** 417/*****************************************************************************

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines