| 38 | }; |
| 39 | |
| 40 | struct BufferedConnectionData { |
| 41 | explicit BufferedConnectionData(Reference<IConnection> connection); |
| 42 | ~BufferedConnectionData() { |
| 43 | // Free left over buffers. |
| 44 | for (auto blk : deadlist) { |
| 45 | delete blk; |
| 46 | } |
| 47 | for (auto blk : buffer) { |
| 48 | delete blk; |
| 49 | } |
| 50 | |
| 51 | conn.cancel(); |
| 52 | connection->close(); |
| 53 | } |
| 54 | |
| 55 | Reference<IConnection> connection; |
| 56 | Future<Void> conn; |
| 57 | |
| 58 | // Blocks that have been advance()d away but not fully popped. memory needs to be held, but that's it |
| 59 | std::list<BCBlock*> deadlist; |
| 60 | int deadlist_begin_offset; |
| 61 | std::list<BCBlock*> buffer; |
| 62 | int buffer_begin_offset, buffer_end_offset; |
| 63 | AsyncVar<int> total_bytes; |
| 64 | AsyncVar<int> desired_bytes; |
| 65 | |
| 66 | AsyncTrigger on_data_write; |
| 67 | UnsentPacketQueue unsent; |
| 68 | |
| 69 | void copyInto(uint8_t* buf, int count); |
| 70 | }; |
| 71 | |
| 72 | ACTOR Future<Void> reader(BufferedConnectionData* self) { |
| 73 | loop { |
nothing calls this directly
no outgoing calls
no test coverage detected