1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01: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
Connection::socketDisconnected()
{
qint64 bytesAvailable = 0;
if ( !m_sock.isNull() )
{
bytesAvailable = m_sock->bytesAvailable();
}
tDebug( LOGVERBOSE ) << "SOCKET DISCONNECTED" << this->name() << id()
<< "shutdown will happen after incoming queue empties."
<< "bytesavail:" << m_sock->bytesAvailable()
<< "bytesavail:" << bytesAvailable
<< "bytesRecvd" << bytesReceived();
m_peer_disconnected = true;
emit socketClosed();
if ( m_msgprocessor_in.length() == 0 && m_sock->bytesAvailable() == 0 )
if ( m_msgprocessor_in.length() == 0 && bytesAvailable == 0 )
{
handleIncomingQueueEmpty();
actualShutdown();