diff --git a/src/Wt/WWebSocketConnection.C b/src/Wt/WWebSocketConnection.C index dadea48c1..677a4ae9c 100644 --- a/src/Wt/WWebSocketConnection.C +++ b/src/Wt/WWebSocketConnection.C @@ -454,7 +454,7 @@ bool WebSocketConnection::doAsyncWrite(OpCode type, const std::vector& fra writeBuffer_.append(data.data(), data.size()); // Put data into asio::buffer actual write buffer - using namespace boost::asio; + using namespace AsioWrapper::asio; std::vector buffer; writeBuffer_.asioBuffers(buffer); @@ -482,7 +482,7 @@ void WebSocketConnection::doControlFrameWrite(const std::vector& frameHead // Put data into asio::buffer actual write buffer writeBuffer_.append(frameHeader.data(), frameHeader.size()); - using namespace boost::asio; + using namespace AsioWrapper::asio; std::vector buffer; writeBuffer_.asioBuffers(buffer); @@ -603,12 +603,10 @@ void WebSocketTcpConnection::doClose() void WebSocketTcpConnection::doSocketRead(char* buffer, size_t size) { - using namespace boost::asio; - - socket_->async_read_some(boost::asio::buffer(buffer, size), strand_.wrap(std::bind(&WebSocketTcpConnection::handleAsyncRead, shared_from_this(), std::placeholders::_1, std::placeholders::_2))); + socket_->async_read_some(AsioWrapper::asio::buffer(buffer, size), strand_.wrap(std::bind(&WebSocketTcpConnection::handleAsyncRead, shared_from_this(), std::placeholders::_1, std::placeholders::_2))); } -void WebSocketTcpConnection::doSocketWrite(const std::vector& buffer, OpCode type) +void WebSocketTcpConnection::doSocketWrite(const std::vector& buffer, OpCode type) { async_write(socket(), buffer, strand_.wrap(std::bind(&WebSocketTcpConnection::handleAsyncWritten, shared_from_this(), type, std::placeholders::_1, std::placeholders::_2))); } @@ -661,12 +659,10 @@ void WebSocketSslConnection::stopTcpSocket(const AsioWrapper::error_code& e) void WebSocketSslConnection::doSocketRead(char* buffer, size_t size) { - using namespace boost::asio; - - socket_->async_read_some(boost::asio::buffer(buffer, size), strand_.wrap(std::bind(&WebSocketSslConnection::handleAsyncRead, shared_from_this(), std::placeholders::_1, std::placeholders::_2))); + socket_->async_read_some(AsioWrapper::asio::buffer(buffer, size), strand_.wrap(std::bind(&WebSocketSslConnection::handleAsyncRead, shared_from_this(), std::placeholders::_1, std::placeholders::_2))); } -void WebSocketSslConnection::doSocketWrite(const std::vector& buffer, OpCode type) +void WebSocketSslConnection::doSocketWrite(const std::vector& buffer, OpCode type) { async_write(*socket_, buffer, strand_.wrap(std::bind(&WebSocketSslConnection::handleAsyncWritten, shared_from_this(), type, std::placeholders::_1, std::placeholders::_2))); } diff --git a/src/Wt/WWebSocketConnection.h b/src/Wt/WWebSocketConnection.h index da34e1b12..ca441cdc6 100644 --- a/src/Wt/WWebSocketConnection.h +++ b/src/Wt/WWebSocketConnection.h @@ -132,7 +132,7 @@ class WT_API WebSocketConnection : public std::enable_shared_from_this& buffer, OpCode type) = 0; + virtual void doSocketWrite(const std::vector& buffer, OpCode type) = 0; private: // Buffer & parsing @@ -174,9 +174,9 @@ class WT_API WebSocketConnection : public std::enable_shared_from_this pendingWritePingBuffer_; - std::vector pendingWritePongBuffer_; - std::vector pendingWriteDataBuffer_; + std::vector pendingWritePingBuffer_; + std::vector pendingWritePongBuffer_; + std::vector pendingWriteDataBuffer_; std::function hasDataReadCallback_; std::function hasDataWrittenCallback_; @@ -199,7 +199,7 @@ class WT_API WebSocketTcpConnection final : public WebSocketConnection protected: void doSocketRead(char* input, size_t offset) final; - void doSocketWrite(const std::vector& buffer, OpCode type) final; + void doSocketWrite(const std::vector& buffer, OpCode type) final; private: std::unique_ptr socket_; @@ -219,7 +219,7 @@ class WT_API WebSocketSslConnection final : public WebSocketConnection protected: void doSocketRead(char* input, size_t offset) final; - void doSocketWrite(const std::vector& buffer, OpCode type) final; + void doSocketWrite(const std::vector& buffer, OpCode type) final; private: std::unique_ptr socket_;