aboutsummaryrefslogtreecommitdiffstats
path: root/lib/plum/stream.rb
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-08-09 01:19:40 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-08-09 01:19:40 +0900
commitb9f7f878793d043bfa49faf21e7b8e988a32f93f (patch)
tree3c9276b3466342e16ca397ae3a5c801af566d480 /lib/plum/stream.rb
parent8b7f6ae897f1abc83c1b8b8585083ac5cde610f0 (diff)
downloadplum-b9f7f878793d043bfa49faf21e7b8e988a32f93f.tar.gz
extract Frame creation into FrameFactory
Diffstat (limited to 'lib/plum/stream.rb')
-rw-r--r--lib/plum/stream.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/plum/stream.rb b/lib/plum/stream.rb
index aa8be7f..e88a70d 100644
--- a/lib/plum/stream.rb
+++ b/lib/plum/stream.rb
@@ -54,19 +54,15 @@ module Plum
end
rescue StreamError => e
callback(:stream_error, e)
- close(e.http2_error_code)
+ close(e.http2_error_type)
end
# Closes this stream. Sends RST_STREAM frame to the peer.
#
- # @param error_code [Integer] The error code to be contained in the RST_STREAM frame.
- def close(error_code = 0)
+ # @param error_type [Symbol] The error type to be contained in the RST_STREAM frame.
+ def close(error_type = :no_error)
@state = :closed
- data = "".force_encoding(Encoding::BINARY)
- data.push_uint32(error_code)
- send_immediately Frame.new(type: :rst_stream,
- stream_id: id,
- payload: data)
+ send_immediately Frame.rst_stream(id, error_type)
end
private