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