| 169 | #endif |
| 170 | |
| 171 | Future<size_t> PollSocketImpl::recv(char* data, size_t size) |
| 172 | { |
| 173 | // Need to hold a copy of `this` so that the underlying socket |
| 174 | // doesn't end up getting reused before we return from the call to |
| 175 | // `io::read` and end up reading data incorrectly. |
| 176 | auto self = shared(this); |
| 177 | |
| 178 | return io::read(get(), data, size) |
| 179 | .then([self](size_t length) { |
| 180 | return length; |
| 181 | }); |
| 182 | } |
| 183 | |
| 184 | |
| 185 | Future<size_t> PollSocketImpl::send(const char* data, size_t size) |