+ }
+
+ // Add the rest of the iovecs unchanged.
+ ret.insert(ret.end(), data.begin() + i, data.end());
+ return ret;
+}
+
+void Stream::add_data_raw(const vector<iovec> &orig_data)
+{
+ vector<iovec> data = orig_data;
+ while (!data.empty()) {
+ size_t pos = bytes_received % backlog_size;
+
+ // Collect as many iovecs as we can before we hit the point
+ // where the circular buffer wraps around.
+ vector<iovec> to_write = collect_iovecs(data, backlog_size - pos);
+ ssize_t ret;
+ do {
+ ret = pwritev(data_fd, to_write.data(), to_write.size(), pos);
+ } while (ret == -1 && errno == EINTR);
+