ds9 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: e93c72e4d28af98ab22cfddbbf23d63464058b22f918bdcd1e8c8757de1446d4
4
- data.tar.gz: 46ba03fb497b1402225e240fd480630dc8a0446b59fef942a6948dbb52878e76
2
+ SHA1:
3
+ metadata.gz: 42d51fe49ecbc5b632752422632d97684cf61174
4
+ data.tar.gz: c5858839be9feb5000e2faba3ea307e17ab3bdc1
5
5
  SHA512:
6
- metadata.gz: e1e6f2f41597ffb538ece6d682bd958e852823b614bfa9cced6d34765df773038262a24eddee98df33378b857d756597cda325a3fb630622e724f1987c145dc4
7
- data.tar.gz: ed37cb22eb7fdd60d8ccb36cacee5b7635a7e790a1258f7eefcb60778495ac35238b72419be134d9faae27a82a72109adbef7848080c6831ec72b1491e3b5972
6
+ metadata.gz: 1be38862c11864eacb2a172822401fdcb6276af652608c1b8223681bdf374461e74c50e220dee1afba6aabbe491798e7238a157b4be28fcb0feb1bb877b05d12
7
+ data.tar.gz: 0320c3c379461605ecd04697798a483d0029b86800ed8167949b550ace6c39f249408884109be357707a146f458c25b2ded16cc6d18ae36a211272b2da89a72e
@@ -696,6 +696,19 @@ static VALUE session_submit_shutdown(VALUE self)
696
696
  return explode(rv);
697
697
  }
698
698
 
699
+ static VALUE session_get_last_proc_stream_id(VALUE self)
700
+ {
701
+ int rv;
702
+ nghttp2_session *session;
703
+
704
+ TypedData_Get_Struct(self, nghttp2_session, &ds9_session_type, session);
705
+ CheckSelf(session);
706
+
707
+ rv = nghttp2_session_get_last_proc_stream_id(session);
708
+
709
+ return INT2NUM(rv);
710
+ }
711
+
699
712
  static VALUE session_submit_goaway(VALUE self, VALUE last_stream_id, VALUE err)
700
713
  {
701
714
  int rv;
@@ -996,6 +1009,7 @@ void Init_ds9(void)
996
1009
  rb_define_method(cDS9Session, "stream_local_closed?", session_stream_local_closed_p, 1);
997
1010
  rb_define_method(cDS9Session, "stream_remote_closed?", session_stream_remote_closed_p, 1);
998
1011
  rb_define_method(cDS9Session, "resume_data", session_resume_data, 1);
1012
+ rb_define_method(cDS9Session, "last_proc_stream_id", session_get_last_proc_stream_id, 0);
999
1013
 
1000
1014
  rb_define_private_method(cDS9Session, "submit_request", session_submit_request, 2);
1001
1015
  rb_define_private_method(cDS9Session, "make_callbacks", make_callbacks, 0);
@@ -108,6 +108,22 @@ static VALUE header_category(VALUE self)
108
108
  return INT2NUM(frame->headers.cat);
109
109
  }
110
110
 
111
+ static VALUE goaway_last_stream_id(VALUE self)
112
+ {
113
+ nghttp2_frame *frame;
114
+ TypedData_Get_Struct(self, nghttp2_frame, &ds9_frame_type, frame);
115
+
116
+ return INT2NUM(frame->goaway.last_stream_id);
117
+ }
118
+
119
+ static VALUE goaway_error_code(VALUE self)
120
+ {
121
+ nghttp2_frame *frame;
122
+ TypedData_Get_Struct(self, nghttp2_frame, &ds9_frame_type, frame);
123
+
124
+ return INT2NUM(frame->goaway.error_code);
125
+ }
126
+
111
127
  void Init_ds9_frames(VALUE mDS9)
112
128
  {
113
129
  mDS9Frames = rb_define_module_under(mDS9, "Frames");
@@ -140,6 +156,8 @@ void Init_ds9_frames(VALUE mDS9)
140
156
  rb_define_const(mDS9FramesFlags, "PADDED", INT2NUM(NGHTTP2_FLAG_PADDED));
141
157
  rb_define_const(mDS9FramesFlags, "PRIORITY", INT2NUM(NGHTTP2_FLAG_PRIORITY));
142
158
 
159
+ rb_define_method(cDS9FramesGoaway, "last_stream_id", goaway_last_stream_id, 0);
160
+ rb_define_method(cDS9FramesGoaway, "error_code", goaway_error_code, 0);
143
161
  rb_define_const(cDS9FramesGoaway, "NO_ERROR", INT2NUM(NGHTTP2_NO_ERROR));
144
162
  rb_define_const(cDS9FramesGoaway, "PROTOCOL_ERROR", INT2NUM(NGHTTP2_PROTOCOL_ERROR));
145
163
  rb_define_const(cDS9FramesGoaway, "INTERNAL_ERROR", INT2NUM(NGHTTP2_INTERNAL_ERROR));
data/lib/ds9.rb CHANGED
@@ -2,7 +2,7 @@ require 'ds9.so'
2
2
  require 'stringio'
3
3
 
4
4
  module DS9
5
- VERSION = '1.2.0'
5
+ VERSION = '1.2.1'
6
6
 
7
7
  module Frames
8
8
  class Frame
@@ -41,6 +41,10 @@ module DS9
41
41
 
42
42
  class Ping
43
43
  def ping?; true; end
44
+
45
+ def ping_ack?
46
+ (flags & Flags::ACK) > 0
47
+ end
44
48
  end
45
49
 
46
50
  class Priority
@@ -143,12 +143,14 @@ module DS9
143
143
 
144
144
  class Server < DS9::Server
145
145
  include IOEvents
146
+ attr_reader :frames
146
147
 
147
148
  def initialize read, write, app
148
149
  @app = app
149
150
  @read_streams = {}
150
151
  @read_post_streams = {}
151
152
  @write_streams = {}
153
+ @frames = []
152
154
  super(read, write)
153
155
  end
154
156
 
@@ -214,6 +216,7 @@ module DS9
214
216
  end
215
217
 
216
218
  def on_frame_recv frame
219
+ @frames << frame
217
220
  return unless (frame.data? || frame.headers?) && frame.end_stream?
218
221
 
219
222
  req_headers = @read_streams[frame.stream_id]
@@ -78,6 +78,10 @@ class TestClient < DS9::TestCase
78
78
  server.send
79
79
  client.receive
80
80
  assert_predicate client.frames.last, :ping?
81
+ client.send
82
+ server.receive
83
+ assert_predicate server.frames.last, :ping?
84
+ assert_predicate server.frames.last, :ping_ack?
81
85
  end
82
86
 
83
87
  def test_push
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ds9
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-17 00:00:00.000000000 Z
11
+ date: 2018-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -47,7 +47,7 @@ dependencies:
47
47
  version: '4.0'
48
48
  - - "<"
49
49
  - !ruby/object:Gem::Version
50
- version: '6'
50
+ version: '7'
51
51
  type: :development
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -57,7 +57,7 @@ dependencies:
57
57
  version: '4.0'
58
58
  - - "<"
59
59
  - !ruby/object:Gem::Version
60
- version: '6'
60
+ version: '7'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: hoe
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.7.6
123
+ rubygems_version: 2.6.14
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: This library allows you to write HTTP/2 clients and servers