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