picloudtcp.cpp revert some mutex

This commit is contained in:
2021-09-01 10:56:11 +03:00
parent be3ce454a0
commit 35a3ce6402
3 changed files with 7 additions and 6 deletions

View File

@@ -26,9 +26,9 @@ PICloudServer::PICloudServer(const PIString & path, PIIODevice::DeviceMode mode)
tcp.setServerName(server_name);
setName("cloud_server__" + server_name);
CONNECTU(&streampacker, packetReceiveEvent, this, _readed);
CONNECTL(&eth, connected, [this](){opened_ = true; tcp.sendStart();});
CONNECTL(&eth, connected, [this](){opened_ = true; piCoutObj << "connected"; tcp.sendStart();});
CONNECTL(&eth, disconnected, [this](bool){
//piCoutObj << "disconnected";
piCoutObj << "disconnected";
static_cast<PIThread*>(&eth)->stop();
opened_ = false;
ping_timer.stop(false);

View File

@@ -72,9 +72,9 @@ void PICloud::TCP::sendConnected(uint client_id) {
header.type = PICloud::TCP::Connect;
PIByteArray ba;
ba << header << client_id;
mutex_send.lock();
// mutex_send.lock();
streampacker->send(ba);
mutex_send.unlock();
// mutex_send.unlock();
}
@@ -82,9 +82,9 @@ void PICloud::TCP::sendDisconnected(uint client_id) {
header.type = PICloud::TCP::Disconnect;
PIByteArray ba;
ba << header << client_id;
mutex_send.lock();
// mutex_send.lock();
streampacker->send(ba);
mutex_send.unlock();
// mutex_send.unlock();
}

View File

@@ -7,6 +7,7 @@ DispatcherServer::DispatcherServer(PIEthernet::Address addr) : eth(PIEthernet::T
max_connections = 1000;
eth.setParameter(PIEthernet::ReuseAddress);
eth.setReadAddress(addr);
// eth.setDebug(false);
CONNECTU(&eth, newConnection, this, newConnection);
CONNECTU(&timeout_timer, tickEvent, this, cleanClients);
}