diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-08-03 17:03:59 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-08-03 17:03:59 +0200 |
commit | f7decf41d8d0062901cd39c42a3669a80537c7df (patch) | |
tree | d3032265df11eee6e3eaf8b4b081524bef5e72b2 /src/Network.cpp | |
parent | 2017-07-29 (diff) | |
download | AltCraft-f7decf41d8d0062901cd39c42a3669a80537c7df.tar AltCraft-f7decf41d8d0062901cd39c42a3669a80537c7df.tar.gz AltCraft-f7decf41d8d0062901cd39c42a3669a80537c7df.tar.bz2 AltCraft-f7decf41d8d0062901cd39c42a3669a80537c7df.tar.lz AltCraft-f7decf41d8d0062901cd39c42a3669a80537c7df.tar.xz AltCraft-f7decf41d8d0062901cd39c42a3669a80537c7df.tar.zst AltCraft-f7decf41d8d0062901cd39c42a3669a80537c7df.zip |
Diffstat (limited to 'src/Network.cpp')
-rw-r--r-- | src/Network.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Network.cpp b/src/Network.cpp index dcdda10..6cd9baa 100644 --- a/src/Network.cpp +++ b/src/Network.cpp @@ -3,9 +3,17 @@ Network::Network(std::string address, unsigned short port) { try { socket = new Socket(address, port); + } catch (std::exception &e) { + LOG(WARNING) << "CONNECT FAULT"; + delete socket; + throw; + } + + try { stream = new StreamSocket(socket); } catch (std::exception &e) { - LOG(FATAL)<<e.what(); + LOG(WARNING) << "NOT STREAMED"; + LOG(FATAL) << e.what(); } } @@ -33,7 +41,7 @@ void Network::SendPacket(Packet &packet) { } std::shared_ptr<Packet> Network::ReceivePacketByPacketId(int packetId, ConnectionState state, StreamInput &stream) { - std::shared_ptr<Packet> packet(nullptr); + std::shared_ptr < Packet > packet(nullptr); switch (state) { case Handshaking: switch (packetId) { |