diff --git a/SourceX/dvlnet/tcp_client.cpp b/SourceX/dvlnet/tcp_client.cpp index e4ad79893..bb740ca85 100644 --- a/SourceX/dvlnet/tcp_client.cpp +++ b/SourceX/dvlnet/tcp_client.cpp @@ -17,6 +17,7 @@ int tcp_client::create(std::string addrstr, std::string passwd) local_server.reset(new tcp_server(ioc, addrstr, port, passwd)); return join(local_server->localhost_self(), passwd); } catch (std::system_error &e) { + eprintf("%s\n", e.what()); return -1; } } @@ -33,6 +34,7 @@ int tcp_client::join(std::string addrstr, std::string passwd) asio::ip::tcp::no_delay option(true); sock.set_option(option); } catch (std::exception &e) { + eprintf("%s\n", e.what()); return -1; } start_recv(); @@ -104,5 +106,11 @@ void tcp_client::send(packet &pkt) }); } +bool tcp_client::SNetLeaveGame(int type){ + if(sock.is_open()) + sock.close(); + return true; +} + } // namespace net } // namespace dvl diff --git a/SourceX/dvlnet/tcp_client.h b/SourceX/dvlnet/tcp_client.h index 21b1d62a7..763457757 100644 --- a/SourceX/dvlnet/tcp_client.h +++ b/SourceX/dvlnet/tcp_client.h @@ -19,6 +19,7 @@ class tcp_client : public base { public: int create(std::string addrstr, std::string passwd); int join(std::string addrstr, std::string passwd); + virtual bool SNetLeaveGame(int type); constexpr static unsigned short default_port = 6112;