summaryrefslogtreecommitdiffstats
path: root/src/Network.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network.cpp')
-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) {