Merge pull request #188 from AttorneyOnline/device-not-open
Fix QIODevice::read (QTcpSocket) device not open error
This commit is contained in:
		
						commit
						ce660b56de
					
				| @ -2181,7 +2181,7 @@ class AOClient : public QObject { | |||||||
|     /**
 |     /**
 | ||||||
|      * @brief The size, in bytes, of the last data the client sent to the server. |      * @brief The size, in bytes, of the last data the client sent to the server. | ||||||
|      */ |      */ | ||||||
|     int last_read; |     int last_read = 0; | ||||||
| 
 | 
 | ||||||
|     /**
 |     /**
 | ||||||
|      * @brief A helper function for logging in a client as moderator. |      * @brief A helper function for logging in a client as moderator. | ||||||
|  | |||||||
| @ -23,6 +23,11 @@ void AOClient::clientData() | |||||||
|         socket->close(); |         socket->close(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     if (last_read == 0) { // i.e. this is the first packet we've been sent
 | ||||||
|  |         if (!socket->waitForConnected(1000)) { | ||||||
|  |             socket->close(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|     QString data = QString::fromUtf8(socket->readAll()); |     QString data = QString::fromUtf8(socket->readAll()); | ||||||
|     last_read = data.size(); |     last_read = data.size(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Rosemary Witchaven
						Rosemary Witchaven