+ return;
+ }
+ bytes_received += ret;
+
+ // Remove the data that was actually written from the set of iovecs.
+ data = remove_iovecs(data, ret);
+ }
+}
+
+void Stream::add_data_deferred(const char *data, size_t bytes, StreamStartSuitability suitable_for_stream_start)
+{
+ assert(suitable_for_stream_start == SUITABLE_FOR_STREAM_START ||
+ suitable_for_stream_start == NOT_SUITABLE_FOR_STREAM_START);
+ if (suitable_for_stream_start == SUITABLE_FOR_STREAM_START) {
+ queued_data_last_starting_point = queued_data.size();
+ }
+
+ if (encoding == Stream::STREAM_ENCODING_METACUBE) {
+ // Add a Metacube block header before the data.
+ metacube_block_header hdr;
+ memcpy(hdr.sync, METACUBE_SYNC, sizeof(hdr.sync));
+ hdr.size = htonl(bytes);
+ hdr.flags = htonl(0);
+ if (suitable_for_stream_start == NOT_SUITABLE_FOR_STREAM_START) {
+ hdr.flags |= htonl(METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START);