QTfrontend/net/tcpBase.cpp
changeset 7615 b39beffcf05e
parent 7587 688076d61b83
parent 7289 835bb2852579
child 7673 e06b83cbde74
equal deleted inserted replaced
7614:3ae60c8a15f2 7615:b39beffcf05e
    29 QList<TCPBase*> srvsList;
    29 QList<TCPBase*> srvsList;
    30 QPointer<QTcpServer> TCPBase::IPCServer(0);
    30 QPointer<QTcpServer> TCPBase::IPCServer(0);
    31 
    31 
    32 TCPBase::~TCPBase()
    32 TCPBase::~TCPBase()
    33 {
    33 {
       
    34     if (IPCSocket)
       
    35         IPCSocket->deleteLater();
    34 }
    36 }
    35 
    37 
    36 TCPBase::TCPBase(bool demoMode) :
    38 TCPBase::TCPBase(bool demoMode) :
    37     m_isDemoMode(demoMode),
    39     m_isDemoMode(demoMode),
    38     IPCSocket(0)
    40     IPCSocket(0)
    63     IPCSocket = IPCServer->nextPendingConnection();
    65     IPCSocket = IPCServer->nextPendingConnection();
    64     if(!IPCSocket) return;
    66     if(!IPCSocket) return;
    65     connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
    67     connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
    66     connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
    68     connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
    67     SendToClientFirst();
    69     SendToClientFirst();
       
    70 
       
    71     if(srvsList.size()==1) srvsList.pop_front();
       
    72     emit isReadyNow();
    68 }
    73 }
    69 
    74 
    70 void TCPBase::RealStart()
    75 void TCPBase::RealStart()
    71 {
    76 {
    72     connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
    77     connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
    86 void TCPBase::ClientDisconnect()
    91 void TCPBase::ClientDisconnect()
    87 {
    92 {
    88     disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
    93     disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
    89     onClientDisconnect();
    94     onClientDisconnect();
    90 
    95 
    91     if(srvsList.size()==1) srvsList.pop_front();
    96  /*   if(srvsList.size()==1) srvsList.pop_front();
    92     emit isReadyNow();
    97     emit isReadyNow();*/
    93     IPCSocket->deleteLater();
    98     IPCSocket->deleteLater();
    94     deleteLater();
    99     deleteLater();
    95 }
   100 }
    96 
   101 
    97 void TCPBase::ClientRead()
   102 void TCPBase::ClientRead()