Class: Net::HTTP::SPDY::StreamSession
- Inherits:
-
Object
- Object
- Net::HTTP::SPDY::StreamSession
- Defined in:
- lib/net/http/spdy/stream_session.rb
Instance Attribute Summary collapse
-
#monitor ⇒ Object
readonly
Returns the value of attribute monitor.
-
#monitor_cond ⇒ Object
readonly
Returns the value of attribute monitor_cond.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
Instance Method Summary collapse
- #create(uri) ⇒ Object
-
#initialize(sock) ⇒ StreamSession
constructor
A new instance of StreamSession.
- #known?(id) ⇒ Boolean
- #parse(buf) ⇒ Object
- #push(id, uri, connected = false) ⇒ Object
- #streams ⇒ Object
Constructor Details
#initialize(sock) ⇒ StreamSession
Returns a new instance of StreamSession.
10 11 12 13 14 15 16 17 |
# File 'lib/net/http/spdy/stream_session.rb', line 10 def initialize(sock) @sock = sock @highest_id = -1 @streams = {} @parser = create_parser @monitor = Monitor.new @monitor_cond = @monitor.new_cond end |
Instance Attribute Details
#monitor ⇒ Object (readonly)
Returns the value of attribute monitor.
8 9 10 |
# File 'lib/net/http/spdy/stream_session.rb', line 8 def monitor @monitor end |
#monitor_cond ⇒ Object (readonly)
Returns the value of attribute monitor_cond.
8 9 10 |
# File 'lib/net/http/spdy/stream_session.rb', line 8 def monitor_cond @monitor_cond end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
8 9 10 |
# File 'lib/net/http/spdy/stream_session.rb', line 8 def parser @parser end |
Instance Method Details
#create(uri) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/net/http/spdy/stream_session.rb', line 19 def create(uri) @monitor.synchronize do @highest_id += 2 end return push(@highest_id, uri) end |
#known?(id) ⇒ Boolean
26 27 28 |
# File 'lib/net/http/spdy/stream_session.rb', line 26 def known?(id) @streams.has_key?(id) end |
#parse(buf) ⇒ Object
37 38 39 |
# File 'lib/net/http/spdy/stream_session.rb', line 37 def parse(buf) @parser << buf end |
#push(id, uri, connected = false) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/net/http/spdy/stream_session.rb', line 30 def push(id, uri, connected=false) s = Stream.new(id, self, @sock, uri) s.connected = connected @streams[id] = s return @streams[id] end |
#streams ⇒ Object
41 42 43 |
# File 'lib/net/http/spdy/stream_session.rb', line 41 def streams @streams.values end |