mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-10 23:56:43 +02:00
trigger onDisconnect
This commit is contained in:
parent
e05e2fdd9d
commit
e5698d8ab1
4 changed files with 24 additions and 5 deletions
|
@ -81,6 +81,16 @@ void StreamServer::onResync(const PipeReader* pipeReader, double ms)
|
|||
}
|
||||
|
||||
|
||||
void StreamServer::onDisconnect(ServerSession* connection)
|
||||
{
|
||||
ClientInfoPtr client = Config::instance().getClientInfo(connection->macAddress);
|
||||
client->connected = false;
|
||||
gettimeofday(&client->lastSeen, NULL);
|
||||
json notification = JsonNotification::getJson("Client.OnDisconnect", client->toJson());
|
||||
controlServer->send(notification.dump(4));
|
||||
}
|
||||
|
||||
|
||||
void StreamServer::onMessageReceived(ServerSession* connection, const msg::BaseMessage& baseMessage, char* buffer)
|
||||
{
|
||||
// logO << "getNextMessage: " << baseMessage.type << ", size: " << baseMessage.size << ", id: " << baseMessage.id << ", refers: " << baseMessage.refersTo << ", sent: " << baseMessage.sent.sec << "," << baseMessage.sent.usec << ", recv: " << baseMessage.received.sec << "," << baseMessage.received.usec << "\n";
|
||||
|
@ -144,7 +154,6 @@ void StreamServer::onMessageReceived(ServerSession* connection, const msg::BaseM
|
|||
gettimeofday(&client->lastSeen, NULL);
|
||||
|
||||
json notification = JsonNotification::getJson("Client.OnConnect", client->toJson());
|
||||
logO << std::setw(4) << notification << std::endl;
|
||||
controlServer->send(notification.dump(4));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue