| 252 | } |
| 253 | |
| 254 | void check_deadline() |
| 255 | { |
| 256 | if (stopped_) |
| 257 | return; |
| 258 | |
| 259 | // Check whether the deadline has passed. We compare the deadline against |
| 260 | // the current time since a new asynchronous operation may have moved the |
| 261 | // deadline before this actor had a chance to run. |
| 262 | if (deadline_.expiry() <= steady_timer::clock_type::now()) |
| 263 | { |
| 264 | // The deadline has passed. The socket is closed so that any outstanding |
| 265 | // asynchronous operations are cancelled. |
| 266 | socket_.close(); |
| 267 | |
| 268 | // There is no longer an active deadline. The expiry is set to the |
| 269 | // maximum time point so that the actor takes no action until a new |
| 270 | // deadline is set. |
| 271 | deadline_.expires_at(steady_timer::time_point::max()); |
| 272 | } |
| 273 | |
| 274 | // Put the actor back to sleep. |
| 275 | deadline_.async_wait(std::bind(&client::check_deadline, this)); |
| 276 | } |
| 277 | |
| 278 | private: |
| 279 | bool stopped_ = false; |
nothing calls this directly
no test coverage detected