QTfrontend/net/tcpBase.cpp
changeset 7289 835bb2852579
parent 7180 53ffc8853008
child 7615 b39beffcf05e
--- a/QTfrontend/net/tcpBase.cpp	Sun Jun 24 21:33:45 2012 +0400
+++ b/QTfrontend/net/tcpBase.cpp	Tue Jun 26 02:14:35 2012 +0400
@@ -26,16 +26,18 @@
 
 #include "hwconsts.h"
 
-//QList<TCPBase*> srvsList;
-//QPointer<QTcpServer> TCPBase::IPCServer(0);
+QList<TCPBase*> srvsList;
+QPointer<QTcpServer> TCPBase::IPCServer(0);
 
 TCPBase::~TCPBase()
 {
+    if (IPCSocket)
+        IPCSocket->deleteLater();
 }
 
 TCPBase::TCPBase(bool demoMode) :
     m_isDemoMode(demoMode),
-    IPCSocket(0), IPCServer(0)
+    IPCSocket(0)
 {
     if(!IPCServer)
     {
@@ -65,9 +67,12 @@
     connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
     connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
     SendToClientFirst();
+
+    if(srvsList.size()==1) srvsList.pop_front();
+    emit isReadyNow();
 }
 
-void TCPBase::/*Real*/Start()
+void TCPBase::RealStart()
 {
     connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
     IPCSocket = 0;
@@ -109,13 +114,13 @@
                           .arg(error) + bindir->absolutePath() + "/hwengine)");
 }
 
-/*
 void TCPBase::tcpServerReady()
 {
     disconnect(srvsList.takeFirst(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady()));
 
     RealStart();
 }
+
 void TCPBase::Start()
 {
     if(srvsList.isEmpty())
@@ -130,7 +135,7 @@
     }
 
     RealStart();
-}*/
+}
 
 void TCPBase::onClientRead()
 {