Class: Quicsilver::Server::PendingStream

Inherits:
Struct
  • Object
show all
Defined in:
lib/quicsilver/server/server.rb

Overview

Tracks an in-flight streaming request between RECEIVE and RECEIVE_FIN. The stream handle arrives at RECEIVE_FIN; the worker thread waits for it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePendingStream

Returns a new instance of PendingStream.



21
22
23
24
25
# File 'lib/quicsilver/server/server.rb', line 21

def initialize(**)
  super
  self.handle_ready = Queue.new
  self.frame_buffer = "".b
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



20
21
22
# File 'lib/quicsilver/server/server.rb', line 20

def body
  @body
end

#connectionObject

Returns the value of attribute connection

Returns:

  • (Object)

    the current value of connection



20
21
22
# File 'lib/quicsilver/server/server.rb', line 20

def connection
  @connection
end

#frame_bufferObject

Returns the value of attribute frame_buffer

Returns:

  • (Object)

    the current value of frame_buffer



20
21
22
# File 'lib/quicsilver/server/server.rb', line 20

def frame_buffer
  @frame_buffer
end

#handle_readyObject

Returns the value of attribute handle_ready

Returns:

  • (Object)

    the current value of handle_ready



20
21
22
# File 'lib/quicsilver/server/server.rb', line 20

def handle_ready
  @handle_ready
end

#priorityObject

Returns the value of attribute priority

Returns:

  • (Object)

    the current value of priority



20
21
22
# File 'lib/quicsilver/server/server.rb', line 20

def priority
  @priority
end

#requestObject

Returns the value of attribute request

Returns:

  • (Object)

    the current value of request



20
21
22
# File 'lib/quicsilver/server/server.rb', line 20

def request
  @request
end

#stream_handleObject

Returns the value of attribute stream_handle

Returns:

  • (Object)

    the current value of stream_handle



20
21
22
# File 'lib/quicsilver/server/server.rb', line 20

def stream_handle
  @stream_handle
end

#stream_idObject

Returns the value of attribute stream_id

Returns:

  • (Object)

    the current value of stream_id



20
21
22
# File 'lib/quicsilver/server/server.rb', line 20

def stream_id
  @stream_id
end

Instance Method Details

#complete(handle) ⇒ Object

Called by RECEIVE_FIN handler to provide the stream handle



28
29
30
31
# File 'lib/quicsilver/server/server.rb', line 28

def complete(handle)
  self.stream_handle = handle
  handle_ready.push(true)
end

#wait_for_handle(timeout: 30) ⇒ Object

Called by worker thread to wait for the stream handle



34
35
36
37
# File 'lib/quicsilver/server/server.rb', line 34

def wait_for_handle(timeout: 30)
  handle_ready.pop(timeout: timeout)
  stream_handle
end