Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions deflect/ServerWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ServerWorker::~ServerWorker()
if( !_streamId.isEmpty( ))
emit removeStreamSource( _streamId, _sourceId );

if( _tcpSocket->state() == QAbstractSocket::ConnectedState )
if( _isConnected( ))
_sendQuit();

delete _tcpSocket;
Expand Down Expand Up @@ -138,7 +138,7 @@ void ServerWorker::_processMessages()
_tcpSocket->flush();

// Finish reading messages from the socket if connection closed
if( _tcpSocket->state() != QAbstractSocket::ConnectedState )
if( !_isConnected( ))
{
while( _tcpSocket->bytesAvailable() >= headerSize )
_receiveMessage();
Expand Down Expand Up @@ -321,8 +321,13 @@ bool ServerWorker::_send( const MessageHeader& messageHeader )
void ServerWorker::_flushSocket()
{
_tcpSocket->flush();
while( _tcpSocket->bytesToWrite() > 0 )
while( _tcpSocket->bytesToWrite() > 0 && _isConnected( ))
_tcpSocket->waitForBytesWritten();
}

bool ServerWorker::_isConnected() const
{
return _tcpSocket->state() == QTcpSocket::ConnectedState;
}

}
1 change: 1 addition & 0 deletions deflect/ServerWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ private slots:
void _sendQuit();
bool _send( const MessageHeader& messageHeader );
void _flushSocket();
bool _isConnected() const;
};

}
Expand Down
3 changes: 3 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changelog {#Changelog}

### 0.12.0 (git master)

* [115](https://github.com/BlueBrain/Deflect/pull/115):
Bugfix for possible endless loop of warnings in ServerWorker::_flushSocket():
"QAbstractSocket::waitForBytesWritten() is not allowed in UnconnectedState"
* [114](https://github.com/BlueBrain/Deflect/pull/114):
QmlStreamer: added support for keyboard events

Expand Down