| 121 | } |
| 122 | |
| 123 | DuplexPipe::DuplexPipe(as::io_context& ioctx, HANDLE pipeHandle, std::string name, bool asClient) |
| 124 | : |
| 125 | name_{ std::move(name) }, |
| 126 | rawPipeHandle_{ pipeHandle }, |
| 127 | asioPipeHandle_{ ioctx }, |
| 128 | readStream_{ &readBuf_ }, |
| 129 | readArchive_{ readStream_ }, |
| 130 | readMtx_{ ioctx }, |
| 131 | writeStream_{ &writeBuf_ }, |
| 132 | writeArchive_{ writeStream_ }, |
| 133 | writeMtx_{ ioctx } |
| 134 | { |
| 135 | if (asClient) { |
| 136 | // client is automatically connected upon creation, so immediatly transfer pipe to asio |
| 137 | asioPipeHandle_.assign(rawPipeHandle_.Release()); |
| 138 | } |
| 139 | } |
| 140 | HANDLE DuplexPipe::Connect_(const std::string& name) |
| 141 | { |
| 142 | win::Handle handle(CreateFileA( |