From 7a96dc4e11f3325395f0ecef21b19827077aa9a1 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Fri, 18 Aug 2017 11:12:12 -0700 Subject: [PATCH] Fix async_read_some handler signature --- CHANGELOG.md | 8 ++++++++ include/boost/beast/websocket/impl/read.ipp | 4 ++-- test/doc/websocket_snippets.cpp | 12 ++++++------ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 177b2bef..a941e7ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +Version 109: + +WebSocket: + +* Fix async_read_some handler signature + +-------------------------------------------------------------------------------- + Version 108: * Fix argument parsing in HTTP examples diff --git a/include/boost/beast/websocket/impl/read.ipp b/include/boost/beast/websocket/impl/read.ipp index 8edf66ee..b809495a 100644 --- a/include/boost/beast/websocket/impl/read.ipp +++ b/include/boost/beast/websocket/impl/read.ipp @@ -861,8 +861,8 @@ async_read_some( "AsyncStream requirements requirements not met"); static_assert(is_dynamic_buffer::value, "DynamicBuffer requirements not met"); - async_completion< - ReadHandler, void(error_code)> init{handler}; + async_completion init{handler}; read_op< DynamicBuffer, handler_type ws{std::move(sock)}; - // Accept the request from our message. Clients SHOULD NOT - // begin sending WebSocket frames until the server has - // provided a response, but just in case they did, we pass - // any leftovers in the buffer to the accept function. - // - ws.accept(req, buffer.data()); + // Clients SHOULD NOT begin sending WebSocket + // frames until the server has provided a response. + BOOST_ASSERT(buffer.size() == 0); + + // Accept the upgrade request + ws.accept(req); } else {