macOS Bluetooth: report RemoteHostClosed error when the RFCOMM channel is closed
The ChannelDelegate::channelClosed() virtual method is called in two cases: * when an attempt to open the channel failed (because of the timeout or an error in rfcommChannelOpenComplete() callbalk). * when the rfcommChannelClosed() callback is triggered. This happens only when the remote host closes the connection. In the first case we set UnknownSocketError. Keep this behavior. In the second case no error was reported, which is different from how other backends behave. This patch updates the code to set the RemoteHostClosed error if the channelClosed() is called, and the socket was in Connected state. Task-number: QTBUG-123430 Pick-to: 6.8 6.7 6.5 Change-Id: Ie21a2e66b570a32b1c4401305738515bc6d04f85 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
This commit is contained in:
parent
05b8398aa6
commit
c382034457
|
|
@ -497,6 +497,8 @@ void QBluetoothSocketPrivateDarwin::channelClosed()
|
|||
// (thus close/abort probably will not work).
|
||||
|
||||
if (!isConnecting) {
|
||||
if (state == QBluetoothSocket::SocketState::ConnectedState)
|
||||
q_ptr->setSocketError(QBluetoothSocket::SocketError::RemoteHostClosedError);
|
||||
q_ptr->setOpenMode(QIODevice::NotOpen);
|
||||
q_ptr->setSocketState(QBluetoothSocket::SocketState::UnconnectedState);
|
||||
emit q_ptr->readChannelFinished();
|
||||
|
|
|
|||
Loading…
Reference in New Issue