summaryrefslogtreecommitdiff
path: root/src/netcomputer.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-10 22:11:11 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-10 22:11:11 +0000
commitbde9a40f0442b6565b891a778ca6e1be03ffb6cf (patch)
treefc9b78c3088eb32adb763b1be9841938f18ae597 /src/netcomputer.cpp
parent4fdfb8328bb6a49864ce2de92425469bd797db74 (diff)
downloadmanaserv-bde9a40f0442b6565b891a778ca6e1be03ffb6cf.tar.gz
manaserv-bde9a40f0442b6565b891a778ca6e1be03ffb6cf.tar.bz2
manaserv-bde9a40f0442b6565b891a778ca6e1be03ffb6cf.tar.xz
manaserv-bde9a40f0442b6565b891a778ca6e1be03ffb6cf.zip
Removed ConnectionHandler::forceDisconnect method and implemented part of the
NetComputer::disconnect method instead. Makes NetComputer::getPeer unnecessary.
Diffstat (limited to 'src/netcomputer.cpp')
-rw-r--r--src/netcomputer.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/netcomputer.cpp b/src/netcomputer.cpp
index dc692916..c9b0339e 100644
--- a/src/netcomputer.cpp
+++ b/src/netcomputer.cpp
@@ -29,15 +29,20 @@
#include "state.h"
NetComputer::NetComputer(ConnectionHandler *handler, ENetPeer *peer):
- handler(handler),
- peer(peer)
+ mHandler(handler),
+ mPeer(peer)
{
}
void NetComputer::disconnect(const std::string &reason)
{
- // Somehow notify the netsession listener about the disconnect after
- // sending this computer a disconnect message containing the reason.
+ // TODO: Send a disconnect message containing the reason, and somehow only
+ // TODO: really disconnect the client after waiting for the client to get
+ // TODO: the message (or likely got it).
+
+ // ENet should generate a disconnect event (notifying the connection
+ // handler)
+ enet_peer_disconnect(mPeer, 0);
}
void NetComputer::send(const Packet *p)
@@ -47,5 +52,5 @@ void NetComputer::send(const Packet *p)
ENET_PACKET_FLAG_RELIABLE);
// Send the packet to the peer over channel id 0.
- enet_peer_send(peer, 0, packet);
+ enet_peer_send(mPeer, 0, packet);
}