diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-10-18 03:42:23 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-10-18 03:42:23 +0300 |
commit | 85002883bd7c2e36613b55b8bec885ce37c3bf18 (patch) | |
tree | 6477a3cd0eafbf131b09ed42c4ee9941f1772b88 /src | |
parent | 22b07bdb30f602d9c469d97b138cf09ee131de62 (diff) | |
download | minetest-85002883bd7c2e36613b55b8bec885ce37c3bf18.tar.gz minetest-85002883bd7c2e36613b55b8bec885ce37c3bf18.tar.bz2 minetest-85002883bd7c2e36613b55b8bec885ce37c3bf18.zip |
Better handling of SendFailedException in Connection
Diffstat (limited to 'src')
-rw-r--r-- | src/connection.cpp | 9 | ||||
-rw-r--r-- | src/socket.cpp | 2 | ||||
-rw-r--r-- | src/socket.h | 2 |
3 files changed, 8 insertions, 5 deletions
diff --git a/src/connection.cpp b/src/connection.cpp index 0f09753bd..623994c4c 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -1104,8 +1104,6 @@ u32 Connection::Receive(u16 &peer_id, u8 *data, u32 datasize) } catch(SendFailedException &e) { - derr_con<<"Receive(): SendFailedException; peer_id=" - <<peer_id<<std::endl; } } // for } @@ -1195,7 +1193,12 @@ void Connection::SendAsPacket(u16 peer_id, u8 channelnum, void Connection::RawSend(const BufferedPacket &packet) { - m_socket.Send(packet.address, *packet.data, packet.data.getSize()); + try{ + m_socket.Send(packet.address, *packet.data, packet.data.getSize()); + } catch(SendFailedException &e){ + derr_con<<"Connection::RawSend(): SendFailedException: " + <<packet.address.serializeString()<<std::endl; + } } void Connection::RunTimeouts(float dtime) diff --git a/src/socket.cpp b/src/socket.cpp index ac4871f61..6d48178f9 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -97,7 +97,7 @@ void Address::Resolve(const char *name) freeaddrinfo(resolved); } -std::string Address::serializeString() +std::string Address::serializeString() const { unsigned int a, b, c, d; a = (m_address & 0xFF000000)>>24; diff --git a/src/socket.h b/src/socket.h index f24947c27..74b5fb643 100644 --- a/src/socket.h +++ b/src/socket.h @@ -97,7 +97,7 @@ public: void setPort(unsigned short port); void print(std::ostream *s) const; void print() const; - std::string serializeString(); + std::string serializeString() const; private: unsigned int m_address; unsigned short m_port; |