diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/netconnection.cc | 8 | ||||
-rw-r--r-- | src/core/netconnection.h | 2 | ||||
-rw-r--r-- | src/core/netserver.cc | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc index 267ff8f..a3a2a43 100644 --- a/src/core/netconnection.cc +++ b/src/core/netconnection.cc @@ -401,10 +401,10 @@ void NetConnection::send_private_message(std::string const &text) } // send a ping reply -void NetConnection::send_ping_reply() +void NetConnection::send_ping_reply(unsigned long timestamp) { std::ostringstream msg; - msg << "ping " << timestamp() << '\n'; + msg << "ping " << timestamp << '\n'; this->send_raw(msg.str()); } @@ -476,14 +476,14 @@ void NetConnection::parse_incoming_message(const std::string & message) } else if (command == "ping") { unsigned long timestamp; if ((msgstream >> timestamp)) { - + send_ping_reply(timestamp); } } else if (command == "frame") { unsigned long timestamp; if ((msgstream >> timestamp)) { + send_ping_reply(timestamp); connection_timestamp = timestamp; - send_ping_reply(); } } else if (command == "die") { diff --git a/src/core/netconnection.h b/src/core/netconnection.h index 371ab04..a17b35d 100644 --- a/src/core/netconnection.h +++ b/src/core/netconnection.h @@ -101,7 +101,7 @@ public: protected: /// send a ping reply - void send_ping_reply(); + void send_ping_reply(unsigned long timestamp); /// add a raw network message to the send queue void send_raw(std::string const &msg); diff --git a/src/core/netserver.cc b/src/core/netserver.cc index e6e85f8..0854692 100644 --- a/src/core/netserver.cc +++ b/src/core/netserver.cc @@ -594,8 +594,6 @@ void NetServer::parse_incoming_message(NetClient *client, const std::string & me unsigned long timestamp; if (msgstream >> timestamp) { client->player()->set_ping(server()->timestamp() - timestamp); - } else { - client->player()->set_ping(-1); } return; } |