summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2015-08-17 23:41:44 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2015-08-17 23:41:44 +0300
commit8c24fe5997591ac4925736d68636b98edf021f43 (patch)
treef6a012ce38a66006f010b41e0a311395f09325e7
parent3627d42af059a52d2095efc783550fe589d68bcb (diff)
server:
server-session init bug fixed bit of trace log client-qt: bit of trace log
-rw-r--r--client-qt/udm-client-qt/client_session.cpp1
-rw-r--r--protocol/udm.proto2
-rw-r--r--server/src/server_session.cpp21
3 files changed, 12 insertions, 12 deletions
diff --git a/client-qt/udm-client-qt/client_session.cpp b/client-qt/udm-client-qt/client_session.cpp
index 1d12172..2069b73 100644
--- a/client-qt/udm-client-qt/client_session.cpp
+++ b/client-qt/udm-client-qt/client_session.cpp
@@ -257,6 +257,7 @@ void client_session::handle_read(const boost::system::error_code& error, size_t
server_msg msg;
if(msg.ParseFromString(s))
{
+ BOOST_LOG_TRIVIAL(trace)<<"received message:\n"<<msg.DebugString();
//parsed = true;
emit server_message_received(msg); //at least one more copy ...., i hope messages will be always small
//another way:
diff --git a/protocol/udm.proto b/protocol/udm.proto
index c26224a..1ecb076 100644
--- a/protocol/udm.proto
+++ b/protocol/udm.proto
@@ -143,7 +143,7 @@ enum PASSWD_HASH_TYPE {
}
message client_auth_info {
- required string password = 1;
+ required bytes password = 1;
optional PASSWD_HASH_TYPE hash_type = 2 [default = HASH_NONE];
}
diff --git a/server/src/server_session.cpp b/server/src/server_session.cpp
index 811b411..d8c4f07 100644
--- a/server/src/server_session.cpp
+++ b/server/src/server_session.cpp
@@ -34,6 +34,13 @@ extern std::map<std::string, client> clients;
server_session::server_session(boost::asio::io_service &s, runtime_config_s &config, std::map<std::string, client*> &clients_, boost::asio::ssl::context *c) : io_service_(s), context_(c), runtime_config(config), clients(clients_)
{
+ if(runtime_config.config_file.get<bool>("server.enable_encryption", false))
+ {
+ socket_ = new socket_wraper(new boost::asio::ssl::stream<boost::asio::ip::tcp::socket>(io_service_, *context_));
+ socket_->get_ssl_socket().async_handshake(boost::asio::ssl::stream_base::server, boost::bind(&server_session::handle_handshake, this, boost::asio::placeholders::error));
+ }
+ else
+ socket_ = new socket_wraper(new boost::asio::ip::tcp::socket(io_service_));
}
socket_wraper* server_session::socket()
@@ -44,17 +51,8 @@ socket_wraper* server_session::socket()
void server_session::run()
{
- if(runtime_config.config_file.get<bool>("server.enable_encryption", false))
- {
- socket_ = new socket_wraper(new boost::asio::ssl::stream<boost::asio::ip::tcp::socket>(io_service_, *context_));
- socket_->get_ssl_socket().async_handshake(boost::asio::ssl::stream_base::server, boost::bind(&server_session::handle_handshake, this, boost::asio::placeholders::error));
- }
- else
- {
- socket_ = new socket_wraper(new boost::asio::ip::tcp::socket(io_service_));
- recv_data_ = new char[4];
- boost::asio::async_read(*socket_, boost::asio::buffer(recv_data_, 4), boost::bind(&server_session::handle_read, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
- }
+ recv_data_ = new char[4];
+ boost::asio::async_read(*socket_, boost::asio::buffer(recv_data_, 4), boost::bind(&server_session::handle_read, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
}
void server_session::handle_handshake(const boost::system::error_code& error)
@@ -99,6 +97,7 @@ void server_session::handle_read(const boost::system::error_code& error, size_t
if(msg.ParseFromString(s))
{
//parsed = true;
+ BOOST_LOG_TRIVIAL(trace)<<"received message:\n"<<msg.DebugString();
handle_command(&msg);
recv_data_ = new char[4];
boost::asio::async_read(*socket_, boost::asio::buffer(recv_data_, 4), boost::bind(&server_session::handle_read, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));