Index: src/vortex_sequencer.c =================================================================== --- src/vortex_sequencer.c (revision 3394) +++ src/vortex_sequencer.c (working copy) @@ -110,6 +110,7 @@ int size_to_copy; char * a_frame; bool resequence; + bool throttling; VortexAsyncQueue * queue; while (true) { @@ -276,6 +277,19 @@ size_to_copy = max_seq_no - next_seq_no + 1; else size_to_copy = message_size; + + /* limit sent size to 1kbyte, as recommended by RFC 3081, sec. 3.1.4. + * This improves throughput by making it less likely for the window to fill up, + * and by avoiding bad interactions with TCP's own flow control. + * However, to work around Vortex problems with split greetings messages, + * we avoid doing this on channel 0. (This workaround can be taken out + * when the underlying problem with greetings parsing is fixed.) */ + if( size_to_copy > 1024 && data->channel_num != 0 ) { + size_to_copy = 1024; + throttling = true; + } else { + throttling = false; + } /* create the new package to be managed by the vortex writer */ packet.type = data->type; @@ -355,6 +369,13 @@ vortex_channel_queue_pending_message (channel, data); } + if (throttling) { + /* there's room in the window but we've queued the message as pending anyway, + * to avoid filling the window. Need to send myself a resequence signal + * so I will wake up immediately and send the next fragment. */ + vortex_sequencer_signal_update(channel); + } + /* because we have queued the message, we want * to avoid the message to be deleted from the * last instruction this while has.