+
+ // It's possible that more data has already arrived during the handshake, so readyRead() wouldn't be triggered.
+ // However, we can't call a virtual function from the ctor, so let's do it asynchronously.
+ if (socket->bytesAvailable())
+ QTimer::singleShot(0, this, SLOT(onSocketDataAvailable()));
+}
+
+
+void RemotePeer::onSocketStateChanged(QAbstractSocket::SocketState state)
+{
+ if (state == QAbstractSocket::ClosingState) {
+ emit statusMessage(tr("Disconnecting..."));
+ }
+}
+
+
+void RemotePeer::onSocketError(QAbstractSocket::SocketError error)
+{
+ emit socketError(error, socket()->errorString());