aboutsummaryrefslogtreecommitdiffstats
path: root/lib/plum/server/connection.rb
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-11-03 11:53:57 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-11-03 12:04:22 +0900
commit3bec944cea2d7c5f09198747e9e33c4cfdbb5cd4 (patch)
tree6ac5516b441e25e4b96dd707171ae2467235bd49 /lib/plum/server/connection.rb
parent3a52f04bc7842dd11df6710d10522ad06180d3b2 (diff)
downloadplum-3bec944cea2d7c5f09198747e9e33c4cfdbb5cd4.tar.gz
split server into plum/server
Diffstat (limited to 'lib/plum/server/connection.rb')
-rw-r--r--lib/plum/server/connection.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/plum/server/connection.rb b/lib/plum/server/connection.rb
new file mode 100644
index 0000000..a801d92
--- /dev/null
+++ b/lib/plum/server/connection.rb
@@ -0,0 +1,18 @@
+# -*- frozen-string-literal: true -*-
+using Plum::BinaryString
+module Plum
+ class ServerConnection < Connection
+ private
+ def negotiate!
+ unless CLIENT_CONNECTION_PREFACE.start_with?(@buffer.byteslice(0, 24))
+ raise ConnectionError.new(:protocol_error) # (MAY) send GOAWAY. sending.
+ end
+
+ if @buffer.bytesize >= 24
+ @buffer.byteshift(24)
+ settings(@local_settings)
+ @state = :waiting_settings
+ end
+ end
+ end
+end