| 481 | } |
| 482 | |
| 483 | void zmq::session_base_t::process_term (int linger_) |
| 484 | { |
| 485 | zmq_assert (!_pending); |
| 486 | |
| 487 | // If the termination of the pipe happens before the term command is |
| 488 | // delivered there's nothing much to do. We can proceed with the |
| 489 | // standard termination immediately. |
| 490 | if (!_pipe && !_zap_pipe && _terminating_pipes.empty ()) { |
| 491 | own_t::process_term (0); |
| 492 | return; |
| 493 | } |
| 494 | |
| 495 | _pending = true; |
| 496 | |
| 497 | if (_pipe != NULL) { |
| 498 | // If there's finite linger value, delay the termination. |
| 499 | // If linger is infinite (negative) we don't even have to set |
| 500 | // the timer. |
| 501 | if (linger_ > 0) { |
| 502 | zmq_assert (!_has_linger_timer); |
| 503 | add_timer (linger_, linger_timer_id); |
| 504 | _has_linger_timer = true; |
| 505 | } |
| 506 | |
| 507 | // Start pipe termination process. Delay the termination till all messages |
| 508 | // are processed in case the linger time is non-zero. |
| 509 | _pipe->terminate (linger_ != 0); |
| 510 | |
| 511 | // TODO: Should this go into pipe_t::terminate ? |
| 512 | // In case there's no engine and there's only delimiter in the |
| 513 | // pipe it wouldn't be ever read. Thus we check for it explicitly. |
| 514 | if (!_engine) |
| 515 | _pipe->check_read (); |
| 516 | } |
| 517 | |
| 518 | if (_zap_pipe != NULL) |
| 519 | _zap_pipe->terminate (false); |
| 520 | } |
| 521 | |
| 522 | void zmq::session_base_t::timer_event (int id_) |
| 523 | { |
nothing calls this directly
no test coverage detected