Don't send client update as Client.Set response

This commit is contained in:
badaix 2016-01-07 20:12:22 +01:00
parent 86f766721d
commit 506f179ed2
3 changed files with 7 additions and 4 deletions

View file

@ -44,7 +44,7 @@ ControlServer::~ControlServer()
}
void ControlServer::send(const std::string& message)
void ControlServer::send(const std::string& message, const ControlSession* excludeSession)
{
std::unique_lock<std::mutex> mlock(mutex_);
for (auto it = sessions_.begin(); it != sessions_.end(); )
@ -63,8 +63,11 @@ void ControlServer::send(const std::string& message)
}
for (auto s : sessions_)
{
if (s.get() != excludeSession)
s->sendAsync(message);
}
}
void ControlServer::onMessageReceived(ControlSession* connection, const std::string& message)

View file

@ -53,7 +53,7 @@ public:
void stop();
/// Send a message to all connceted clients
void send(const std::string& message);
void send(const std::string& message, const ControlSession* excludeSession = NULL);
/// Clients call this when they receive a message. Implementation of MessageReceiver::onMessageReceived
virtual void onMessageReceived(ControlSession* connection, const std::string& message);

View file

@ -196,7 +196,7 @@ void StreamServer::onMessageReceived(ControlSession* controlSession, const std::
Config::instance().save();
json notification = JsonNotification::getJson("Client.OnUpdate", clientInfo->toJson());
controlServer_->send(notification.dump());
controlServer_->send(notification.dump(), controlSession);
}
controlSession->send(request.getResponse(response).dump());