--- deliantra/server/socket/lowlevel.C 2007/09/01 08:03:46 1.57 +++ deliantra/server/socket/lowlevel.C 2007/10/01 01:09:10 1.60 @@ -353,21 +353,17 @@ { inbuf_len += amount; - cmd_ev.start (); + if (handle_packet ()) + { + while (handle_packet ()) + ; + + flush (); + } } } } -// called whenever we have additional commands to process -void -client::cmd_cb (iw &w) -{ - if (handle_packet ()) - w.start (); - else - flush (); -} - /******************************************************************************* * * Start of write related routines. @@ -489,7 +485,15 @@ void client::send_msg (int color, const char *type, const char *msg) { - if (msg_is_special (msg) || (type [0] == 'c' && type [1] == '/')) + if (!msg || !type) // it can happen (for example, missing attack messages cause this) + { + LOG (logBacktrace | llevError, "send_msg(%d,%p,%p) called with NULL msg or type.\n", color, type, msg); + return; + } + + int len = strlen (msg); + + if (msg_is_special (msg) || (type [0] == 'c' && type [1] == '/') || len > (MAXSOCKBUF - 128)) cfperl_send_msg (this, color, type, msg); else if (can_msg) send_packet_printf ("msg %d %s %s", color & NDI_CLIENT_MASK, type, msg);