summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-07-31 20:15:51 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-07-31 20:15:51 +0000
commit713254672b345150fe5d0c40d229e9dff1a80d89 (patch)
treee54c443996da862d44ff911a5419beedca1bf73e /src/net
parentaff167beefadc32add4b44626cc2f1cbef800c7b (diff)
downloadmana-713254672b345150fe5d0c40d229e9dff1a80d89.tar.gz
mana-713254672b345150fe5d0c40d229e9dff1a80d89.tar.bz2
mana-713254672b345150fe5d0c40d229e9dff1a80d89.tar.xz
mana-713254672b345150fe5d0c40d229e9dff1a80d89.zip
Corrected an off by one error in packet size.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/network.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/net/network.cpp b/src/net/network.cpp
index 64cbf331..f18cf412 100644
--- a/src/net/network.cpp
+++ b/src/net/network.cpp
@@ -66,7 +66,7 @@ bool Network::connect(const std::string &address, short port)
mState = CONNECTING;
- mClient = enet_host_create(0, 1, 0, 0);
+ mClient = enet_host_create(NULL, 1, 0, 0);
if (!mClient)
{
@@ -160,10 +160,8 @@ void Network::dispatchMessages()
void Network::flush()
{
- logger->log("Network::flush()");
if (mState == IDLE || mState == NET_ERROR)
{
- logger->log("Idle or error, returning");
return;
}
@@ -218,11 +216,14 @@ void Network::send(MessageOut *msg)
{
if (mState == IDLE || mState == NET_ERROR)
{
+ logger->log("Warning: attempt to send a message while network not "
+ "ready.");
return;
}
ENetPacket *packet = enet_packet_create(msg->getData(),
- msg->getDataSize() + 1, ENET_PACKET_FLAG_RELIABLE);
+ msg->getDataSize(),
+ ENET_PACKET_FLAG_RELIABLE);
mOutgoingPackets.push(packet);
}