Skip to content

Commit 1a5fa96

Browse files
authored
Merge pull request #19 from nabto/sc-3871
Use connected/disconnected instead of offline/online
2 parents 9c13224 + 6411e14 commit 1a5fa96

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

examples/libdatachannel/src/common/webrtc_connection/webrtc_connection.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,8 @@ void WebrtcConnection::handleChannelStateChange(
423423
std::shared_ptr<rtc::PeerConnection> pc = nullptr;
424424

425425
switch (state) {
426-
case nabto::webrtc::SignalingChannelState::OFFLINE:
427-
NPLOGD << "Got channel state: OFFLINE";
426+
case nabto::webrtc::SignalingChannelState::DISCONNECTED:
427+
NPLOGD << "Got channel state: DISCONNECTED";
428428
// This means we tried to send a signaling message but the client is
429429
// not connected to the backend. If we expect the client to connect
430430
// momentarily, we will then get a CLIENT_CONNECTED event and the
@@ -443,8 +443,8 @@ void WebrtcConnection::handleChannelStateChange(
443443
deinit();
444444
}
445445
break;
446-
case nabto::webrtc::SignalingChannelState::ONLINE:
447-
NPLOGD << "Got channel state ONLINE";
446+
case nabto::webrtc::SignalingChannelState::CONNECTED:
447+
NPLOGD << "Got channel state CONNECTED";
448448
// This means client reconnected, the client should do ICE restart
449449
// if needed so we can just ignore.
450450
break;

sdk/integration_test/integration_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ TEST(connect, client_disconnect_after_connect) {
315315
ASSERT_TRUE(cliConn != nullptr);
316316
cliConn->addStateChangeListener(
317317
[&connEventProm](nabto::webrtc::SignalingChannelState event) {
318-
if (event == nabto::webrtc::SignalingChannelState::OFFLINE) {
318+
if (event == nabto::webrtc::SignalingChannelState::DISCONNECTED) {
319319
connEventProm.set_value();
320320
}
321321
});

sdk/src/signaling_device/include/nabto/webrtc/device.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,16 +362,16 @@ std::string signalingDeviceStateToString(SignalingDeviceState state);
362362
* Events a Signaling Channel can emit.
363363
*
364364
* - NEW: The channel was just created.
365-
* - ONLINE: The SDK received an indication that the client is online.
366-
* - OFFLINE: The SDK tried to send a message to the client but the client was
365+
* - CONNECTED: The SDK received an indication that the client is online.
366+
* - DISCONNECTED: The SDK tried to send a message to the client but the client was
367367
* offline.
368368
* - FAILED: The channel received a error, which is fatal in the protocol.
369369
* - CLOSED: The channel was closed by the application.
370370
*/
371371
enum class SignalingChannelState : std::uint8_t {
372372
NEW,
373-
ONLINE,
374-
OFFLINE,
373+
CONNECTED,
374+
DISCONNECTED,
375375
FAILED,
376376
CLOSED
377377
};

sdk/src/signaling_device/src/signaling.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ std::string signalingChannelStateToString(SignalingChannelState state) {
2828
switch (state) {
2929
case SignalingChannelState::NEW:
3030
return "NEW";
31-
case SignalingChannelState::ONLINE:
32-
return "ONLINE";
33-
case SignalingChannelState::OFFLINE:
34-
return "OFFLINE";
31+
case SignalingChannelState::CONNECTED:
32+
return "CONNECTED";
33+
case SignalingChannelState::DISCONNECTED:
34+
return "DISCONNECTED";
3535
case SignalingChannelState::FAILED:
3636
return "FAILED";
3737
case SignalingChannelState::CLOSED:

sdk/src/signaling_device/src/signaling_channel_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void SignalingChannelImpl::peerConnected() {
124124
signaler_->websocketSendMessage(channelId_, message);
125125
}
126126
}
127-
changeState(SignalingChannelState::ONLINE);
127+
changeState(SignalingChannelState::CONNECTED);
128128
}
129129

130130
void SignalingChannelImpl::peerOffline() {
@@ -133,7 +133,7 @@ void SignalingChannelImpl::peerOffline() {
133133

134134
NABTO_SIGNALING_LOGI << "Peer: " << channelId_ << " went offline";
135135
}
136-
changeState(SignalingChannelState::OFFLINE);
136+
changeState(SignalingChannelState::DISCONNECTED);
137137
}
138138

139139
void SignalingChannelImpl::handleError(const SignalingError& error) {

0 commit comments

Comments
 (0)