Resolve parenting issues
This should FINALLY resolve the QIODevice errors as closing the socket now lets Qt handle all the network and socket state management.
This commit is contained in:
		
							parent
							
								
									16955e9c16
								
							
						
					
					
						commit
						a47e120ff4
					
				| @ -59,10 +59,10 @@ QHostAddress NetworkSocket::peerAddress() | |||||||
| void NetworkSocket::close() | void NetworkSocket::close() | ||||||
| { | { | ||||||
|     if (m_socket_type == TCP) { |     if (m_socket_type == TCP) { | ||||||
|         m_client_socket.tcp->close(); |         m_client_socket.tcp->deleteLater(); | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|         m_client_socket.ws->close(); |         m_client_socket.ws->deleteLater(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -171,7 +171,9 @@ void Server::clientConnected() | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     int user_id = m_available_ids.pop(); |     int user_id = m_available_ids.pop(); | ||||||
|     NetworkSocket *l_socket = new NetworkSocket(socket, this); |     // The parent hierachry looks like this :
 | ||||||
|  |     // QTcpSocket -> NetworkSocket -> AOClient
 | ||||||
|  |     NetworkSocket *l_socket = new NetworkSocket(socket, socket); | ||||||
|     AOClient *client = new AOClient(this, l_socket, l_socket, user_id, music_manager); |     AOClient *client = new AOClient(this, l_socket, l_socket, user_id, music_manager); | ||||||
|     m_clients_ids.insert(user_id, client); |     m_clients_ids.insert(user_id, client); | ||||||
| 
 | 
 | ||||||
| @ -241,7 +243,7 @@ void Server::clientConnected() | |||||||
| void Server::ws_clientConnected() | void Server::ws_clientConnected() | ||||||
| { | { | ||||||
|     QWebSocket *socket = ws_server->nextPendingConnection(); |     QWebSocket *socket = ws_server->nextPendingConnection(); | ||||||
|     NetworkSocket *l_socket = new NetworkSocket(socket, this); |     NetworkSocket *l_socket = new NetworkSocket(socket, socket); | ||||||
| 
 | 
 | ||||||
|     // Too many players. Reject connection!
 |     // Too many players. Reject connection!
 | ||||||
|     // This also enforces the maximum playercount.
 |     // This also enforces the maximum playercount.
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Salanto
						Salanto