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

Comparing deliantra/server/socket/lowlevel.C (file contents):
Revision 1.35 by root, Wed Mar 14 00:04:59 2007 UTC vs.
Revision 1.38 by root, Tue Apr 3 00:21:38 2007 UTC

202 {"mapinfo", PC(MapInfoCmd) 0 }, /* CF+ */ 202 {"mapinfo", PC(MapInfoCmd) 0 }, /* CF+ */
203 203
204 {"reply", SC(ReplyCmd) 0 }, 204 {"reply", SC(ReplyCmd) 0 },
205 {"exti", SC(ExtiCmd) 0 }, /* CF+ */ 205 {"exti", SC(ExtiCmd) 0 }, /* CF+ */
206 {"addme", SC(AddMeCmd) 0 }, 206 {"addme", SC(AddMeCmd) 0 },
207 {"askface", SC(SendFaceCmd) 0 }, /* Added: phil */ 207 {"askface", SC(AskFaceCmd) 0 },
208 {"requestinfo", SC(RequestInfo) 0 }, 208 {"requestinfo", SC(RequestInfo) 0 },
209 {"setfacemode", SC(SetFaceMode) 0 }, 209 {"setfacemode", SC(SetFaceMode) 0 },
210 {"setsound", SC(SetSound) 0 }, 210 {"setsound", SC(SetSound) 0 },
211 {"setup", SC(SetUp) 0 }, 211 {"setup", SC(SetUp) 0 },
212 {"version", SC(VersionCmd) 0 }, 212 {"version", SC(VersionCmd) 0 },
416 return; 416 return;
417 417
418 if (len + outputbuffer.len > SOCKETBUFSIZE) 418 if (len + outputbuffer.len > SOCKETBUFSIZE)
419 { 419 {
420 LOG (llevDebug, "socket on fd %d has overrun internal buffer - marking as dead\n", fd); 420 LOG (llevDebug, "socket on fd %d has overrun internal buffer - marking as dead\n", fd);
421 destroy (); 421 // shutdown the socket, this is safer than destroying it immediately
422 // as lots of code in the callchain might still access the map etc.
423 shutdown (fd, SHUT_RDWR);
422 return; 424 return;
423 } 425 }
424 426
425 int avail, end; 427 int avail, end;
426 428
523 int len = strlen (name); 525 int len = strlen (name);
524 memcpy (cur, name, len); cur += len; 526 memcpy (cur, name, len); cur += len;
525 *cur++ = ' '; 527 *cur++ = ' ';
526} 528}
527 529
530packet &packet::operator <<(const ber32 v)
531{
532 enum { maxlen = 32 / 7 + 1};
533 uint8 buf[maxlen];
534 uint8 *p = buf + maxlen;
535 uint32 val = v.val;
536
537 *--p = val & 0x7F;
538
539 while (val > 0x7F)
540 {
541 val >>= 7;
542 *--p = (val & 0x7F) | 0x80;
543 }
544
545 return *this << data (p, buf + maxlen - p);
546}
547
528packet &packet::operator <<(const data &v) 548packet &packet::operator <<(const data &v)
529{ 549{
530 if (room () < v.len) 550 if (room () < v.len)
531 reset (); 551 reset ();
532 else 552 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines