diff options
author | ipknHama <ipknhama@gmail.com> | 2017-09-18 02:58:53 +0900 |
---|---|---|
committer | ipknHama <ipknhama@gmail.com> | 2017-09-18 02:58:53 +0900 |
commit | 2c26b6c1def35f7b509f699097fdfb9480e9461c (patch) | |
tree | 3c7097832e5380ed04e6dd5ae6f603059b62c1f9 /include/crow/websocket.h | |
parent | e93ba25f2cd156a6544a3c9894cd667906146874 (diff) | |
download | crow-2c26b6c1def35f7b509f699097fdfb9480e9461c.tar.gz crow-2c26b6c1def35f7b509f699097fdfb9480e9461c.zip |
Change default settings
- disable crow debug mode by default
- expose `loglevel` method on `App` to change the logging level easily
- add a startup message that guides how to change the logging level
Diffstat (limited to 'include/crow/websocket.h')
-rw-r--r-- | include/crow/websocket.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/include/crow/websocket.h b/include/crow/websocket.h index c0e8c3f..ee0885f 100644 --- a/include/crow/websocket.h +++ b/include/crow/websocket.h @@ -183,7 +183,12 @@ namespace crow { //boost::asio::async_read(adaptor_.socket(), boost::asio::buffer(&mini_header_, 1), adaptor_.socket().async_read_some(boost::asio::buffer(&mini_header_, 2), - [this](const boost::system::error_code& ec, std::size_t bytes_transferred) + [this](const boost::system::error_code& ec, std::size_t +#ifdef CROW_ENABLE_DEBUG + bytes_transferred +#endif + ) + { is_reading = false; mini_header_ = htons(mini_header_); @@ -228,7 +233,11 @@ namespace crow remaining_length_ = 0; uint16_t remaining_length16_ = 0; boost::asio::async_read(adaptor_.socket(), boost::asio::buffer(&remaining_length16_, 2), - [this,&remaining_length16_](const boost::system::error_code& ec, std::size_t bytes_transferred) + [this,&remaining_length16_](const boost::system::error_code& ec, std::size_t +#ifdef CROW_ENABLE_DEBUG + bytes_transferred +#endif + ) { is_reading = false; remaining_length16_ = ntohs(remaining_length16_); @@ -259,7 +268,11 @@ namespace crow case WebSocketReadState::Len64: { boost::asio::async_read(adaptor_.socket(), boost::asio::buffer(&remaining_length_, 8), - [this](const boost::system::error_code& ec, std::size_t bytes_transferred) + [this](const boost::system::error_code& ec, std::size_t +#ifdef CROW_ENABLE_DEBUG + bytes_transferred +#endif + ) { is_reading = false; remaining_length_ = ((1==ntohl(1)) ? (remaining_length_) : ((uint64_t)ntohl((remaining_length_) & 0xFFFFFFFF) << 32) | ntohl((remaining_length_) >> 32)); @@ -288,7 +301,11 @@ namespace crow break; case WebSocketReadState::Mask: boost::asio::async_read(adaptor_.socket(), boost::asio::buffer((char*)&mask_, 4), - [this](const boost::system::error_code& ec, std::size_t bytes_transferred) + [this](const boost::system::error_code& ec, std::size_t +#ifdef CROW_ENABLE_DEBUG + bytes_transferred +#endif + ) { is_reading = false; #ifdef CROW_ENABLE_DEBUG |