important:
* PIThread::~PIThread() now unregister itself from introspection, if terminates than show warning * PISystemMonitor now correctly stops * PIPeer now can correctly stopAndWait * PIPeer::destroy(), protected method for close all eths and threads * new PIINTROSPECTION_STOP macro * Introspection now can be correctly stopped by macro, more safety ClientServer: * ClientBase::close() stop and disconnect channel * Server clients clean-up now event-based * No warnings on client destructor
This commit is contained in:
@@ -18,13 +18,15 @@
|
||||
|
||||
#include "piclientserver_client.h"
|
||||
|
||||
#include "piclientserver_server.h"
|
||||
#include "piethernet.h"
|
||||
|
||||
|
||||
void PIClientServer::ServerClient::createForServer(PIEthernet * tcp_) {
|
||||
void PIClientServer::ServerClient::createForServer(Server * parent, PIEthernet * tcp_) {
|
||||
tcp = tcp_;
|
||||
tcp->setParameter(PIEthernet::KeepConnection, false);
|
||||
init();
|
||||
CONNECTL(tcp, disconnected, ([this, parent](bool) { parent->clientDisconnected(this); }));
|
||||
}
|
||||
|
||||
|
||||
@@ -37,13 +39,14 @@ PIClientServer::Client::Client() {
|
||||
|
||||
|
||||
PIClientServer::Client::~Client() {
|
||||
stop();
|
||||
if (tcp) tcp->setDebug(false);
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
void PIClientServer::Client::connect(PINetworkAddress addr) {
|
||||
if (!tcp || !own_tcp) return;
|
||||
stop();
|
||||
close();
|
||||
tcp->connect(addr, true);
|
||||
tcp->startThreadedRead();
|
||||
piCout << "Connect to" << addr.toString();
|
||||
|
||||
Reference in New Issue
Block a user