obmc_console.hpp (5238bd3205c61efa4ff82c0c5a4eb9d594a0865b) | obmc_console.hpp (81ce609e30274435b4f8c3fc65340c6b6b153b0c) |
---|---|
1#pragma once 2#include <sys/socket.h> 3 4#include <app.hpp> 5#include <async_resp.hpp> 6#include <boost/asio/local/stream_protocol.hpp> 7#include <boost/container/flat_map.hpp> 8#include <boost/container/flat_set.hpp> --- 31 unchanged lines hidden (view full) --- 40 { 41 BMCWEB_LOG_ERROR << "doWrite(): Socket closed."; 42 return; 43 } 44 45 doingWrite = true; 46 hostSocket->async_write_some( 47 boost::asio::buffer(inputBuffer.data(), inputBuffer.size()), | 1#pragma once 2#include <sys/socket.h> 3 4#include <app.hpp> 5#include <async_resp.hpp> 6#include <boost/asio/local/stream_protocol.hpp> 7#include <boost/container/flat_map.hpp> 8#include <boost/container/flat_set.hpp> --- 31 unchanged lines hidden (view full) --- 40 { 41 BMCWEB_LOG_ERROR << "doWrite(): Socket closed."; 42 return; 43 } 44 45 doingWrite = true; 46 hostSocket->async_write_some( 47 boost::asio::buffer(inputBuffer.data(), inputBuffer.size()), |
48 [](boost::beast::error_code ec, std::size_t bytes_written) { | 48 [](boost::beast::error_code ec, std::size_t bytesWritten) { |
49 doingWrite = false; | 49 doingWrite = false; |
50 inputBuffer.erase(0, bytes_written); | 50 inputBuffer.erase(0, bytesWritten); |
51 52 if (ec == boost::asio::error::eof) 53 { 54 for (crow::websocket::Connection* session : sessions) 55 { 56 session->close("Error in reading to host port"); 57 } 58 return; --- 84 unchanged lines hidden (view full) --- 143 if (sessions.empty()) 144 { 145 hostSocket = nullptr; 146 inputBuffer.clear(); 147 inputBuffer.shrink_to_fit(); 148 } 149 }) 150 .onmessage([]([[maybe_unused]] crow::websocket::Connection& conn, | 51 52 if (ec == boost::asio::error::eof) 53 { 54 for (crow::websocket::Connection* session : sessions) 55 { 56 session->close("Error in reading to host port"); 57 } 58 return; --- 84 unchanged lines hidden (view full) --- 143 if (sessions.empty()) 144 { 145 hostSocket = nullptr; 146 inputBuffer.clear(); 147 inputBuffer.shrink_to_fit(); 148 } 149 }) 150 .onmessage([]([[maybe_unused]] crow::websocket::Connection& conn, |
151 const std::string& data, 152 [[maybe_unused]] bool is_binary) { | 151 const std::string& data, [[maybe_unused]] bool isBinary) { |
153 inputBuffer += data; 154 doWrite(); 155 }); 156} 157} // namespace obmc_console 158} // namespace crow | 152 inputBuffer += data; 153 doWrite(); 154 }); 155} 156} // namespace obmc_console 157} // namespace crow |