Module: HTTPX::Plugins::StreamBidi::ConnectionMethods

Defined in:
lib/httpx/plugins/stream_bidi.rb,
sig/plugins/stream_bidi.rbs

Overview

overrides the declaration of @write_buffer, which is now a thread-safe buffer responding to the same API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#signal=(value) ⇒ Object (writeonly)

Sets the attribute signal

Parameters:

  • value —

    the value to set the attribute signal to.



375
376
377
# File 'lib/httpx/plugins/stream_bidi.rb', line 375

def signal=(value)
  @signal = value
end

Instance Method Details

#call ⇒ Object



394
395
396
397
398
# File 'lib/httpx/plugins/stream_bidi.rb', line 394

def call
  return super unless @options.stream && (error = @signal.error)

  on_error(error)
end

#initialize ⇒ Object



377
378
379
380
381
382
383
# File 'lib/httpx/plugins/stream_bidi.rb', line 377

def initialize(*)
  super

  return unless @options.stream

  @write_buffer = BidiBuffer.new(@options.buffer_size)
end

#interests ⇒ Object

rebuffers the @write_buffer before calculating interests.



386
387
388
389
390
391
392
# File 'lib/httpx/plugins/stream_bidi.rb', line 386

def interests
  return super unless @options.stream

  @write_buffer.rebuffer

  super
end