Module: Yahns::ClientExpireGeneric
- Defined in:
- lib/yahns/client_expire_generic.rb
Overview
Copyright © 2013, Eric Wong <[email protected]> and all contributors License: GPLv3 or later (www.gnu.org/licenses/gpl-3.0.txt)
Instance Method Summary collapse
-
#__timestamp ⇒ Object
:nodoc:.
- #kgio_tryread(*args) ⇒ Object
- #kgio_trywrite(*args) ⇒ Object
- #trysendfile(*args) ⇒ Object
- #yahns_expire(timeout) ⇒ Object
- #yahns_init ⇒ Object
Instance Method Details
#__timestamp ⇒ Object
:nodoc:
4 5 6 |
# File 'lib/yahns/client_expire_generic.rb', line 4 def Time.now.to_f end |
#kgio_tryread(*args) ⇒ Object
31 32 33 34 |
# File 'lib/yahns/client_expire_generic.rb', line 31 def kgio_tryread(*args) @last_io_at = super end |
#kgio_trywrite(*args) ⇒ Object
26 27 28 29 |
# File 'lib/yahns/client_expire_generic.rb', line 26 def kgio_trywrite(*args) @last_io_at = super end |
#trysendfile(*args) ⇒ Object
36 37 38 39 |
# File 'lib/yahns/client_expire_generic.rb', line 36 def trysendfile(*args) @last_io_at = super end |
#yahns_expire(timeout) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/yahns/client_expire_generic.rb', line 13 def yahns_expire(timeout) return 0 if closed? if ( - @last_io_at) > timeout shutdown 1 else 0 end # shutdown may race with the shutdown in http_response_done rescue 0 end |
#yahns_init ⇒ Object
8 9 10 11 |
# File 'lib/yahns/client_expire_generic.rb', line 8 def yahns_init super # Yahns::HttpClient#yahns_init @last_io_at = 0 end |