Small time sync fix

This commit is contained in:
badaix 2020-02-09 19:51:48 +01:00
parent d82c3c42ae
commit 83ab1cb260
2 changed files with 3 additions and 4 deletions

View file

@ -628,9 +628,8 @@ void StreamServer::onMessageReceived(StreamSession* streamSession, const msg::Ba
timeMsg->deserialize(baseMessage, buffer);
timeMsg->refersTo = timeMsg->id;
timeMsg->latency = timeMsg->received - timeMsg->sent;
// LOG(INFO) << "Latency sec: " << timeMsg.latency.sec << ", usec: " << timeMsg.latency.usec << ", refers to: " << timeMsg.refersTo <<
//"\n";
streamSession->sendAsync(timeMsg, true);
// LOG(INFO) << "Latency sec: " << timeMsg.latency.sec << ", usec: " << timeMsg.latency.usec << ", refers to: " << timeMsg.refersTo << "\n";
streamSession->sendAsync(timeMsg);
// refresh streamSession state
ClientInfoPtr client = Config::instance().getClientInfo(streamSession->clientId);

View file

@ -166,8 +166,8 @@ void StreamSession::sendAsync(msg::message_ptr message, bool send_now)
if (!message)
return;
// sendAsync(shared_const_buffer(*message), send_now);
tv t;
// TODO: better set the timestamp in send_next for more accurate time sync
message->sent = t;
std::ostringstream oss;
message->serialize(oss);