101 if(IPCSocket) |
102 if(IPCSocket) |
102 { |
103 { |
103 // connection should be already finished |
104 // connection should be already finished |
104 return; |
105 return; |
105 } |
106 } |
|
107 |
106 disconnect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection())); |
108 disconnect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection())); |
107 IPCSocket = IPCServer->nextPendingConnection(); |
109 IPCSocket = IPCServer->nextPendingConnection(); |
|
110 |
108 if(!IPCSocket) return; |
111 if(!IPCSocket) return; |
|
112 |
|
113 m_connected = true; |
|
114 |
109 connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect())); |
115 connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect())); |
110 connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); |
116 connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); |
111 SendToClientFirst(); |
117 SendToClientFirst(); |
|
118 |
|
119 if(simultaneousRun()) |
|
120 { |
|
121 srvsList.removeOne(this); |
|
122 emit isReadyNow(); |
|
123 } |
112 } |
124 } |
113 |
125 |
114 void TCPBase::RealStart() |
126 void TCPBase::RealStart() |
115 { |
127 { |
116 connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection())); |
128 connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection())); |
147 void TCPBase::ClientDisconnect() |
159 void TCPBase::ClientDisconnect() |
148 { |
160 { |
149 disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); |
161 disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); |
150 onClientDisconnect(); |
162 onClientDisconnect(); |
151 |
163 |
152 emit isReadyNow(); |
164 if(!simultaneousRun()) |
|
165 emit isReadyNow(); |
153 IPCSocket->deleteLater(); |
166 IPCSocket->deleteLater(); |
154 |
167 |
155 deleteLater(); |
168 deleteLater(); |
156 } |
169 } |
157 |
170 |
186 else |
199 else |
187 { |
200 { |
188 TCPBase * last = srvsList.last(); |
201 TCPBase * last = srvsList.last(); |
189 if(couldCancelPreviousRequest |
202 if(couldCancelPreviousRequest |
190 && last->couldBeRemoved() |
203 && last->couldBeRemoved() |
|
204 && (last->isConnected() || !last->hasStarted()) |
191 && (last->parent() == parent())) |
205 && (last->parent() == parent())) |
192 { |
206 { |
193 srvsList.removeLast(); |
207 srvsList.removeLast(); |
194 last->deleteLater(); |
208 last->deleteLater(); |
195 Start(couldCancelPreviousRequest); |
209 Start(couldCancelPreviousRequest); |
196 } else |
210 } else |
197 { |
211 { |
198 connect(srvsList.last(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); |
212 connect(last, SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); |
199 srvsList.push_back(this); |
213 srvsList.push_back(this); |
200 } |
214 } |
201 } |
215 } |
202 } |
216 } |
203 |
217 |