1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-09 23:57:34 +02:00

Connection should be able to shutdown even if the socket already disappeared

This commit is contained in:
Uwe L. Korn
2013-05-18 11:24:38 +02:00
parent e55b83914e
commit 3823bce04e

View File

@@ -311,15 +311,20 @@ Connection::doSetup()
void void
Connection::socketDisconnected() Connection::socketDisconnected()
{ {
qint64 bytesAvailable = 0;
if ( !m_sock.isNull() )
{
bytesAvailable = m_sock->bytesAvailable();
}
tDebug( LOGVERBOSE ) << "SOCKET DISCONNECTED" << this->name() << id() tDebug( LOGVERBOSE ) << "SOCKET DISCONNECTED" << this->name() << id()
<< "shutdown will happen after incoming queue empties." << "shutdown will happen after incoming queue empties."
<< "bytesavail:" << m_sock->bytesAvailable() << "bytesavail:" << bytesAvailable
<< "bytesRecvd" << bytesReceived(); << "bytesRecvd" << bytesReceived();
m_peer_disconnected = true; m_peer_disconnected = true;
emit socketClosed(); emit socketClosed();
if ( m_msgprocessor_in.length() == 0 && m_sock->bytesAvailable() == 0 ) if ( m_msgprocessor_in.length() == 0 && bytesAvailable == 0 )
{ {
handleIncomingQueueEmpty(); handleIncomingQueueEmpty();
actualShutdown(); actualShutdown();