diff options
Diffstat (limited to 'lib/plum/client/connection.rb')
-rw-r--r-- | lib/plum/client/connection.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/plum/client/connection.rb b/lib/plum/client/connection.rb new file mode 100644 index 0000000..fc96a9a --- /dev/null +++ b/lib/plum/client/connection.rb @@ -0,0 +1,19 @@ +# -*- frozen-string-literal: true -*- +using Plum::BinaryString +module Plum + class ClientConnection < Connection + def initialize(writer, local_settings = {}) + super(writer, local_settings) + + writer.call(CLIENT_CONNECTION_PREFACE) + settings(local_settings) + @state = :waiting_settings + end + + def open_stream(**args) + next_id = @max_odd_stream_id > 0 ? @max_odd_stream_id + 2 : 1 + stream = new_stream(next_id, state: :open, **args) + stream + end + end +end |