Difference for socket/loop.c from version 1.36 to 1.37


version 1.36 version 1.37
Line 1
 
Line 1
   
 /*  /*
  * static char *rcsid_loop_c =   * static char *rcsid_loop_c =
  *    "$Id: loop.c,v 1.36 2005/12/07 18:25:56 akirschbaum Exp $";   *    "$Id: loop.c,v 1.37 2005/12/11 19:11:32 akirschbaum Exp $";
  */   */
   
 /*  /*
Line 183
 
Line 183
      * or no more characters to read.       * or no more characters to read.
      */       */
     do {      do {
    if (ns->inbuf.len >= MAXSOCKBUF-1) {
        ns->status = Ns_Dead;
        LOG(llevDebug, "Old input socket sent too much data without newline\n");
        return;
    }
 #ifdef WIN32 /* ***win32: change oldsocket read() to recv() */  #ifdef WIN32 /* ***win32: change oldsocket read() to recv() */
  stat = recv(ns->fd, ns->inbuf.buf + ns->inbuf.len, 1,0);   stat = recv(ns->fd, ns->inbuf.buf + ns->inbuf.len, 1,0);
   
Line 199
 
Line 204
      return;       return;
  }   }
  if (stat == 0) return;   if (stat == 0) return;
  if (stat == MAXSOCKBUF-1) {  
      ns->status = Ns_Dead;  
      LOG(llevDebug, "Old input socket sent too much data without newline\n");  
      return;  
  }  
     } while (ns->inbuf.buf[ns->inbuf.len++]!='\n');      } while (ns->inbuf.buf[ns->inbuf.len++]!='\n');
   
     ns->inbuf.buf[ns->inbuf.len]=0;      ns->inbuf.buf[ns->inbuf.len]=0;
Line 229
 
Line 229
  return;   return;
     }      }
     if (!strcasecmp(ns->inbuf.buf, "listen")) {      if (!strcasecmp(ns->inbuf.buf, "listen")) {
  if (ns->comment) free(ns->comment);  
  if (cp) {   if (cp) {
      char *buf="Socket switched to listen mode\n";       char *buf="Socket switched to listen mode\n";
   
        free(ns->comment);
      ns->comment = strdup_local(cp);       ns->comment = strdup_local(cp);
      ns->old_mode = Old_Listen;       ns->old_mode = Old_Listen;
      cs_write_string(ns, buf, strlen(buf));       cs_write_string(ns, buf, strlen(buf));
Line 257
 
Line 257
   
  if (!verify_player(cp, cp1)) {   if (!verify_player(cp, cp1)) {
      char *buf="Welcome back\n";       char *buf="Welcome back\n";
      if (ns->comment) free(ns->comment);       free(ns->comment);
      ns->comment = strdup_local(cp);       ns->comment = strdup_local(cp);
      ns->old_mode = Old_Player;       ns->old_mode = Old_Player;
      cs_write_string(ns, buf, strlen(buf));       cs_write_string(ns, buf, strlen(buf));
Line 274
 
Line 274
  command = find_oldsocket_command2(ns->inbuf.buf);   command = find_oldsocket_command2(ns->inbuf.buf);
     }      }
     if (!command) {      if (!command) {
  sprintf(buf,"Could not find command: %s\n", ns->inbuf.buf);   snprintf(buf, sizeof(buf), "Could not find command: %s\n", ns->inbuf.buf);
  cs_write_string(ns, buf, strlen(buf));   cs_write_string(ns, buf, strlen(buf));
  return;   return;
     }      }


Legend:
line(s) removed in v.1.36 
line(s) changed
 line(s) added in v.1.37

File made using version 1.98 of cvs2html by leaf at 2011-07-21 19:35