From bde9a40f0442b6565b891a778ca6e1be03ffb6cf Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 10 Aug 2006 22:11:11 +0000 Subject: Removed ConnectionHandler::forceDisconnect method and implemented part of the NetComputer::disconnect method instead. Makes NetComputer::getPeer unnecessary. --- src/netcomputer.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/netcomputer.cpp') diff --git a/src/netcomputer.cpp b/src/netcomputer.cpp index dc69291..c9b0339 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); } -- cgit