Method: Protocol::HTTP2::Connection#process_settings

Defined in:
lib/protocol/http2/connection.rb

#process_settings(frame) ⇒ Boolean

In addition to changing the flow-control window for streams that are not yet active, a SETTINGS frame can alter the initial flow-control window size for streams with active flow-control windows (that is, streams in the “open” or “half-closed (remote)” state). When the value of SETTINGS_INITIAL_WINDOW_SIZE changes, a receiver MUST adjust the size of all stream flow-control windows that it maintains by the difference between the new value and the old value.

Returns:

  • (Boolean)

    whether the frame was an acknowledgement



268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/protocol/http2/connection.rb', line 268

def process_settings(frame)
  if frame.acknowledgement?
    # The remote end has confirmed the settings have been received:
    changes = @local_settings.acknowledge
    
    update_local_settings(changes)
    
    return true
  else
    # The remote end is updating the settings, we reply with acknowledgement:
    reply = frame.acknowledge
    
    write_frame(reply)
    
    changes = frame.unpack
    @remote_settings.update(changes)
    
    update_remote_settings(changes)
    
    return false
  end
end