mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-16 10:36:17 +02:00
latency
git-svn-id: svn://elaine/murooma/trunk@257 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
3369363453
commit
6d6272d23a
5 changed files with 44 additions and 8 deletions
|
@ -1,4 +1,5 @@
|
|||
#include "controlServer.h"
|
||||
#include "common/timeMsg.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
@ -9,7 +10,16 @@ ControlServer::ControlServer(unsigned short port) : port_(port), headerChunk(NUL
|
|||
|
||||
void ControlServer::onMessageReceived(SocketConnection* connection, const BaseMessage& baseMessage, char* buffer)
|
||||
{
|
||||
cout << "onMessageReceived: " << baseMessage.type << ", " << baseMessage.size << "\n";
|
||||
cout << "onMessageReceived: " << baseMessage.type << ", size: " << baseMessage.size << ", sent: " << baseMessage.sent.sec << "," << baseMessage.sent.usec << ", recv: " << baseMessage.received.sec << "," << baseMessage.received.usec << "\n";
|
||||
if (baseMessage.type == message_type::timemsg)
|
||||
{
|
||||
TimeMsg* timeMsg = new TimeMsg();
|
||||
timeMsg->deserialize(baseMessage, buffer);
|
||||
timeMsg->latency = (timeMsg->received.sec - timeMsg->sent.sec) * 1000000 + (timeMsg->received.usec - timeMsg->sent.usec);
|
||||
cout << "Latency: " << timeMsg->latency << "\n";
|
||||
timeMsg->refersTo = timeMsg->id;
|
||||
connection->send(timeMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue