File tree 2 files changed +39
-0
lines changed
include/boost/beast/websocket/impl
2 files changed +39
-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 14
14
#include < boost/beast/_experimental/test/tcp.hpp>
15
15
#include < boost/beast/core/flat_buffer.hpp>
16
16
17
+ #include < thread>
18
+
17
19
namespace boost {
18
20
namespace beast {
19
21
namespace websocket {
@@ -163,10 +165,46 @@ class read1_test : public unit_test::suite
163
165
164
166
}
165
167
168
+ void
169
+ testIssue2999 ()
170
+ {
171
+ net::io_context ioc;
172
+
173
+ // Use handshake_timeout for the closing handshake,
174
+ // which can occur in websocket::stream::async_read_some.
175
+ stream<test::stream> ws1 (ioc);
176
+ stream<test::stream> ws2 (ioc);
177
+ test::connect (ws1.next_layer (), ws2.next_layer ());
178
+ ws1.async_handshake (" test" , " /" , test::success_handler ());
179
+ ws2.async_accept (test::success_handler ());
180
+ test::run (ioc);
181
+
182
+ flat_buffer b;
183
+ ws1.set_option (stream_base::timeout{
184
+ std::chrono::milliseconds (50 ),
185
+ stream_base::none (),
186
+ false });
187
+ // add a close frame to the input
188
+ ws1.next_layer ().append (string_view{
189
+ " \x88\x00 " , 2 });
190
+ ws1.async_read (b, test::fail_handler (
191
+ beast::error::timeout));
192
+ // limit the write buffer so that writing
193
+ // the close frame will not complete during
194
+ // the call to ioc.run_one()
195
+ ws1.next_layer ().write_size (1 );
196
+ ioc.run_one ();
197
+ ioc.restart ();
198
+ std::this_thread::sleep_for (
199
+ std::chrono::milliseconds (100 ));
200
+ test::run (ioc);
201
+ }
202
+
166
203
void
167
204
run () override
168
205
{
169
206
testTimeout ();
207
+ testIssue2999 ();
170
208
}
171
209
};
172
210
You can’t perform that action at this time.
0 commit comments