summaryrefslogtreecommitdiffstats
path: root/src/Network.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-08-03 17:03:59 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-08-03 17:03:59 +0200
commitf7decf41d8d0062901cd39c42a3669a80537c7df (patch)
treed3032265df11eee6e3eaf8b4b081524bef5e72b2 /src/Network.cpp
parent2017-07-29 (diff)
downloadAltCraft-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 '')
-rw-r--r--src/Network.cpp12
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) {