Files
pip/utils/cloud_dispatcher/cloudserver.cpp
2021-04-05 17:42:02 +03:00

43 lines
698 B
C++

#include "cloudserver.h"
CloudServer::CloudServer(DispatcherClient * c, const PIString & sname) : server(c) {
setName(sname);
server_name = sname;
}
CloudServer::~CloudServer() {
for (auto c :clients) {
c->close();
}
}
PIString CloudServer::serverName() const {
return server_name;
}
void CloudServer::addClient(DispatcherClient * c) {
clients << c;
}
void CloudServer::removeClient(DispatcherClient * c) {
clients.removeOne(c);
}
PIVector<DispatcherClient *> CloudServer::getClients() {
return clients;
}
void CloudServer::printStatus() {
piCout << " " << "Clients for" << server->address() << ":";
for (auto c: clients) {
piCout << " " << c->address();
}
}