diff options
author | Stijn Buys <ingar@osirion.org> | 2009-01-10 15:35:45 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-01-10 15:35:45 +0000 |
commit | 44500292f5a964036e9d915a38a2773bf5aa765d (patch) | |
tree | 04e791247062a78b753017afad6d96e32a367900 /src/core/netconnection.cc | |
parent | b8668c7a181ff082e5aeabffeaa413677da3e6f9 (diff) |
preliminary player ping support
Diffstat (limited to 'src/core/netconnection.cc')
-rw-r--r-- | src/core/netconnection.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc index 7e12ce7..267ff8f 100644 --- a/src/core/netconnection.cc +++ b/src/core/netconnection.cc @@ -400,6 +400,14 @@ void NetConnection::send_private_message(std::string const &text) this->send_raw(msg); } +// send a ping reply +void NetConnection::send_ping_reply() +{ + std::ostringstream msg; + msg << "ping " << timestamp() << '\n'; + this->send_raw(msg.str()); +} + // parse incoming client messages /** * The following incoming messages are parsed; @@ -466,11 +474,16 @@ void NetConnection::parse_incoming_message(const std::string & message) abort(); } else if (command == "ping") { + unsigned long timestamp; + if ((msgstream >> timestamp)) { + + } } else if (command == "frame") { unsigned long timestamp; if ((msgstream >> timestamp)) { connection_timestamp = timestamp; + send_ping_reply(); } } else if (command == "die") { |