| 248 | } |
| 249 | |
| 250 | void RemoteClientBridge::Commit() { |
| 251 | // Get number of streams |
| 252 | uint32_t streamCount; |
| 253 | storage.ConsumeStreams(&streamCount, nullptr); |
| 254 | |
| 255 | // Get all streams |
| 256 | streamCache.resize(streamCount); |
| 257 | storage.ConsumeStreams(&streamCount, streamCache.data()); |
| 258 | |
| 259 | // Push all streams |
| 260 | for (uint32_t i = 0; i < streamCount; i++) { |
| 261 | const MessageStream &stream = streamCache[i]; |
| 262 | |
| 263 | // Setup protocol header |
| 264 | MessageStreamHeaderProtocol protocol; |
| 265 | protocol.schema = stream.GetSchema(); |
| 266 | protocol.versionID = stream.GetVersionID(); |
| 267 | protocol.size = stream.GetByteSize(); |
| 268 | |
| 269 | // Send header and stream data (sync) |
| 270 | client->WriteAsync(&protocol, sizeof(protocol)); |
| 271 | client->WriteAsync(stream.GetDataBegin(), protocol.size); |
| 272 | |
| 273 | // Tracking |
| 274 | info.bytesWritten += sizeof(protocol); |
| 275 | info.bytesWritten += protocol.size; |
| 276 | } |
| 277 | |
| 278 | // Commit all inbound streams |
| 279 | memoryBridge.Commit(); |
| 280 | } |
no test coverage detected