diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 2 | ||||
-rw-r--r-- | src/connectionhandler.cpp | 5 | ||||
-rw-r--r-- | src/connectionhandler.h | 5 | ||||
-rw-r--r-- | src/netcomputer.cpp | 15 | ||||
-rw-r--r-- | src/netcomputer.h | 11 |
5 files changed, 13 insertions, 25 deletions
diff --git a/src/client.cpp b/src/client.cpp index 752d65d0..995fe7e1 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) std::cout << "4) Logout 13) Say around" << std::endl; std::cout << "5) Change Password 14) Equip Item" << std::endl; std::cout << "6) Change Email 15) Ruby Expression" << std::endl; - std::cout << "7) Get Email 16) Enter world" << std::endl; + std::cout << "7) Get Email 16) Request game server token" << std::endl; std::cout << "8) Create character 17) Enter world (GS)" << std::endl; std::cout << "Choose your option: "; std::cin >> answer; diff --git a/src/connectionhandler.cpp b/src/connectionhandler.cpp index bf2e942b..8b4d7a9f 100644 --- a/src/connectionhandler.cpp +++ b/src/connectionhandler.cpp @@ -92,11 +92,6 @@ void ConnectionHandler::stopListen() // FIXME: memory leak on NetComputers } -void ConnectionHandler::forceDisconnect(NetComputer *comp) -{ - enet_peer_disconnect(comp->getPeer(), 0); // ENet should generate a disconnect event -} - void ConnectionHandler::flush() { enet_host_flush(host); diff --git a/src/connectionhandler.h b/src/connectionhandler.h index 3ce8bdbe..f43b1237 100644 --- a/src/connectionhandler.h +++ b/src/connectionhandler.h @@ -85,11 +85,6 @@ class ConnectionHandler //void receivePacket(NetComputer *computer, Packet *packet); /** - * Force disconnection of target computer. - */ - void forceDisconnect(NetComputer *); - - /** * Send packet to every client, used for announcements. */ void sendToEveryone(MessageOut &); 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); } diff --git a/src/netcomputer.h b/src/netcomputer.h index 6f68ef2c..e1e328dd 100644 --- a/src/netcomputer.h +++ b/src/netcomputer.h @@ -77,16 +77,9 @@ class NetComputer send(const Packet *p); //void send(Packet *p, bool reliable = true); - /** - * Return the peer - */ - ENetPeer *getPeer() { return peer; } - private: - ConnectionHandler *handler; - - std::queue<Packet*> queue; /**< Message Queue (FIFO) */ - ENetPeer *peer; /**< Client peer */ + ConnectionHandler *mHandler; /**< Connection handler */ + ENetPeer *mPeer; /**< Client peer */ }; #endif |