| 262 | explicit SslReadByteFlow(SslStreamImpl *stream) : stream_(stream) { |
| 263 | } |
| 264 | bool loop() final { |
| 265 | auto to_read = output_.prepare_append(); |
| 266 | auto r_size = stream_->read(to_read); |
| 267 | if (r_size.is_error()) { |
| 268 | finish(r_size.move_as_error()); |
| 269 | return false; |
| 270 | } |
| 271 | auto size = r_size.move_as_ok(); |
| 272 | if (size == 0) { |
| 273 | return false; |
| 274 | } |
| 275 | output_.confirm_append(size); |
| 276 | return true; |
| 277 | } |
| 278 | |
| 279 | size_t read(MutableSlice data) { |
| 280 | return input_->advance(min(data.size(), input_->size()), data); |