+
+ // Careful now. If the message is gargantuan, trying to write multiple gigamegs in one
+ // big write operation can make our transport unhappy. So we'll chunk it up 10 KB at a time.
+ bytes_written = 0;
+ while ( (bytes_written < encoded_len) && (!server_shutting_down) ) {
+ this_block = encoded_len - bytes_written;
+ if (this_block > 10240) {
+ this_block = 10240;
+ }
+ client_write(&encoded_msg[bytes_written], this_block);
+ bytes_written += this_block;
+ }