… | |
… | |
351 | } |
351 | } |
352 | else |
352 | else |
353 | { |
353 | { |
354 | inbuf_len += amount; |
354 | inbuf_len += amount; |
355 | |
355 | |
356 | cmd_ev.start (); |
|
|
357 | } |
|
|
358 | } |
|
|
359 | } |
|
|
360 | |
|
|
361 | // called whenever we have additional commands to process |
|
|
362 | void |
|
|
363 | client::cmd_cb (iw &w) |
|
|
364 | { |
|
|
365 | if (handle_packet ()) |
356 | if (handle_packet ()) |
366 | w.start (); |
357 | { |
367 | else |
358 | while (handle_packet ()) |
368 | flush (); |
359 | ; |
|
|
360 | |
|
|
361 | flush (); |
|
|
362 | } |
|
|
363 | } |
|
|
364 | } |
369 | } |
365 | } |
370 | |
366 | |
371 | /******************************************************************************* |
367 | /******************************************************************************* |
372 | * |
368 | * |
373 | * Start of write related routines. |
369 | * Start of write related routines. |
… | |
… | |
493 | { |
489 | { |
494 | LOG (logBacktrace | llevError, "send_msg(%d,%p,%p) called with NULL msg or type.\n", color, type, msg); |
490 | LOG (logBacktrace | llevError, "send_msg(%d,%p,%p) called with NULL msg or type.\n", color, type, msg); |
495 | return; |
491 | return; |
496 | } |
492 | } |
497 | |
493 | |
|
|
494 | int len = strlen (msg); |
|
|
495 | |
498 | if (msg_is_special (msg) || (type [0] == 'c' && type [1] == '/')) |
496 | if (msg_is_special (msg) || (type [0] == 'c' && type [1] == '/') || len > (MAXSOCKBUF - 128)) |
499 | cfperl_send_msg (this, color, type, msg); |
497 | cfperl_send_msg (this, color, type, msg); |
500 | else if (can_msg) |
498 | else if (can_msg) |
501 | send_packet_printf ("msg %d %s %s", color & NDI_CLIENT_MASK, type, msg); |
499 | send_packet_printf ("msg %d %s %s", color & NDI_CLIENT_MASK, type, msg); |
502 | else if (color < 0) |
500 | else if (color < 0) |
503 | return; // client cannot handle this |
501 | return; // client cannot handle this |