aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppStream.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2015-08-27 09:35:49 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2015-08-27 09:35:49 +0200
commit0947e36e3d1e63920e4b1fa9193d6f1d1690eae7 (patch)
tree5e7b336151983386064638535a7cd0b695c2c385 /src/base/QXmppStream.cpp
parentcaa5bdcad5693518c08b03402c19c96a24086639 (diff)
downloadqxmpp-0947e36e3d1e63920e4b1fa9193d6f1d1690eae7.tar.gz
don't try to send stream end if socket is disconnected
Diffstat (limited to 'src/base/QXmppStream.cpp')
-rw-r--r--src/base/QXmppStream.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/base/QXmppStream.cpp b/src/base/QXmppStream.cpp
index 80f2c9f3..4feb266c 100644
--- a/src/base/QXmppStream.cpp
+++ b/src/base/QXmppStream.cpp
@@ -86,10 +86,13 @@ QXmppStream::~QXmppStream()
void QXmppStream::disconnectFromHost()
{
- sendData(streamRootElementEnd);
- if (d->socket)
- {
- d->socket->flush();
+ if (d->socket) {
+ if (d->socket->state() == QAbstractSocket::ConnectedState) {
+ sendData(streamRootElementEnd);
+ d->socket->flush();
+ }
+ // FIXME: according to RFC 6120 section 4.4, we should wait for
+ // the incoming stream to end before closing the socket
d->socket->disconnectFromHost();
}
}