Module: HTTPX::Plugins::Persistent::InstanceMethods

Defined in:
lib/httpx/plugins/persistent.rb

Instance Method Summary collapse

Instance Method Details

#closeObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/httpx/plugins/persistent.rb', line 39

def close(*)
  super

  # traverse other threads and unlink respective selector
  # WARNING: this is not thread safe, make sure that the session isn't being
  # used anymore, or all non-main threads are stopped.
  Thread.list.each do |th|
    store = thread_selector_store(th)

    next unless store && store.key?(self)

    selector = store.delete(self)

    selector_close(selector)
  end
end