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.52 by root, Sat Jul 28 00:15:18 2007 UTC vs.
Revision 1.53 by root, Sat Jul 28 12:02:58 2007 UTC

62 //fprintf (stderr, "uack %d sst %d cwnd %d mss %d pmtu %d\n", 62 //fprintf (stderr, "uack %d sst %d cwnd %d mss %d pmtu %d\n",
63 // tcpi.tcpi_unacked, tcpi.tcpi_snd_ssthresh, tcpi.tcpi_snd_cwnd, tcpi.tcpi_advmss, tcpi.tcpi_pmtu); 63 // tcpi.tcpi_unacked, tcpi.tcpi_snd_ssthresh, tcpi.tcpi_snd_cwnd, tcpi.tcpi_advmss, tcpi.tcpi_pmtu);
64 64
65 if (tcpi.tcpi_last_ack_recv > int (SOCKET_TIMEOUT * 1000)) 65 if (tcpi.tcpi_last_ack_recv > int (SOCKET_TIMEOUT * 1000))
66 { 66 {
67 send_msg (NDI_RED, "connection-timeout", "safety disconnect due to tcp/ip timeout (no packets received)"); 67 send_msg (NDI_RED | NDI_REPLY, "connection-timeout", "safety disconnect due to tcp/ip timeout (no packets received)");
68 write_outputbuffer (); 68 write_outputbuffer ();
69 69
70 LOG (llevDebug, "connection on fd %d closed due to ack timeout (%u/%u/%u)\n", fd, 70 LOG (llevDebug, "connection on fd %d closed due to ack timeout (%u/%u/%u)\n", fd,
71 (unsigned)tcpi.tcpi_last_ack_recv, (unsigned)tcpi.tcpi_last_data_sent, (unsigned)tcpi.tcpi_unacked); 71 (unsigned)tcpi.tcpi_last_ack_recv, (unsigned)tcpi.tcpi_last_data_sent, (unsigned)tcpi.tcpi_unacked);
72 destroy (); 72 destroy ();
164 if (inbuf_len >= 2 + pkt_len) 164 if (inbuf_len >= 2 + pkt_len)
165 return 2 + pkt_len; 165 return 2 + pkt_len;
166 166
167 if (inbuf_len == sizeof (inbuf)) 167 if (inbuf_len == sizeof (inbuf))
168 { 168 {
169 send_packet_printf ("drawinfo %d input buffer overflow - closing connection.", NDI_RED); 169 send_packet_printf ("drawinfo %d input buffer overflow - closing connection.", NDI_RED | NDI_REPLY);
170 destroy (); 170 destroy ();
171 return -1; 171 return -1;
172 } 172 }
173 } 173 }
174 174
268 ((void (*)(char *, int, player *))pkt->cb)((char *)data, datalen, pl); 268 ((void (*)(char *, int, player *))pkt->cb)((char *)data, datalen, pl);
269 else 269 else
270 ((void (*)(char *, int, client *))pkt->cb)((char *)data, datalen, this); 270 ((void (*)(char *, int, client *))pkt->cb)((char *)data, datalen, this);
271 } 271 }
272 else 272 else
273 send_packet_printf ("drawinfo %d ERROR: you cannot execute '%s' now.", NDI_RED, pkt->name); 273 send_packet_printf ("drawinfo %d ERROR: you cannot execute '%s' now.", NDI_RED | NDI_REPLY, pkt->name);
274} 274}
275 275
276bool 276bool
277client::handle_packet () 277client::handle_packet ()
278{ 278{
319 319
320 goto next_packet; 320 goto next_packet;
321 } 321 }
322 322
323 // If we get here, we didn't find a valid command. 323 // If we get here, we didn't find a valid command.
324 send_packet_printf ("drawinfo %d ERROR: command '%s' not supported.", NDI_RED, (char *)inbuf + 2); 324 send_packet_printf ("drawinfo %d ERROR: command '%s' not supported.", NDI_RED | NDI_REPLY, (char *)inbuf + 2);
325next_packet: 325next_packet:
326 skip_packet (pkt_len); 326 skip_packet (pkt_len);
327 327
328 // input buffer has space again 328 // input buffer has space again
329 socket_ev.poll (socket_ev.poll () | PE_R); 329 socket_ev.poll (socket_ev.poll () | PE_R);
522client::send_msg (int color, const char *type, const char *msg) 522client::send_msg (int color, const char *type, const char *msg)
523{ 523{
524 if (msg_is_special (msg)) 524 if (msg_is_special (msg))
525 cfperl_send_msg (this, color, type, msg); 525 cfperl_send_msg (this, color, type, msg);
526 else if (can_msg) 526 else if (can_msg)
527 send_packet_printf ("msg %d %s %s", color, type, msg); 527 send_packet_printf ("msg %d %s %s", color & NDI_CLIENT_MASK, type, msg);
528 else if (color < 0) 528 else if (color < 0)
529 return; // client cannot handle this 529 return; // client cannot handle this
530 else 530 else
531 send_packet_printf ("drawinfo %d %s", color, msg); 531 send_packet_printf ("drawinfo %d %s", color & NDI_COLOR_MASK, msg);
532} 532}
533 533
534void 534void
535client::send_drawinfo (const char *msg, int flags) 535client::send_drawinfo (const char *msg, int flags)
536{ 536{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines