File tree 2 files changed +36
-0
lines changed
include/boost/beast/websocket/impl
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -662,6 +662,7 @@ class stream<NextLayer, deflateSupported>::read_some_op
662
662
}
663
663
664
664
impl.change_status (status::closing);
665
+ impl.update_timer (this ->get_executor ());
665
666
666
667
if (! impl.wr_close )
667
668
{
Original file line number Diff line number Diff line change @@ -163,10 +163,45 @@ class read1_test : public unit_test::suite
163
163
164
164
}
165
165
166
+ void
167
+ testIssue2999 ()
168
+ {
169
+ net::io_context ioc;
170
+
171
+ // Use handshake_timeout for the closing handshake,
172
+ // which can occur in websocket::stream::async_read_some.
173
+ stream<test::stream> ws1 (ioc);
174
+ stream<test::stream> ws2 (ioc);
175
+ test::connect (ws1.next_layer (), ws2.next_layer ());
176
+ ws1.async_handshake (" test" , " /" , test::success_handler ());
177
+ ws2.async_accept (test::success_handler ());
178
+ test::run (ioc);
179
+
180
+ flat_buffer b;
181
+ ws1.set_option (stream_base::timeout{
182
+ std::chrono::milliseconds (50 ),
183
+ stream_base::none (),
184
+ false });
185
+ // add a close frame to the input
186
+ ws1.next_layer ().append (string_view{
187
+ " \x88\x00 " , 2 });
188
+ ws1.async_read (b, test::fail_handler (
189
+ beast::error::timeout));
190
+ // limit the write buffer so that writing
191
+ // the close frame will not complete during
192
+ // the call to ioc.run_one()
193
+ ws1.next_layer ().write_size (1 );
194
+ ioc.run_one ();
195
+ std::this_thread::sleep_for (
196
+ std::chrono::milliseconds (100 ));
197
+ ioc.run ();
198
+ }
199
+
166
200
void
167
201
run () override
168
202
{
169
203
testTimeout ();
204
+ testIssue2999 ();
170
205
}
171
206
};
172
207
You can’t perform that action at this time.
0 commit comments