From 523cd04f1b2e702874494be9ad9e977212c49226 Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Mon, 9 Sep 2024 22:34:27 +0530 Subject: [PATCH 1/2] Added missing implementation to set channel suspended state when conn goes suspended --- ably/realtime_channel.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ably/realtime_channel.go b/ably/realtime_channel.go index 84469845..2d1c6c57 100644 --- a/ably/realtime_channel.go +++ b/ably/realtime_channel.go @@ -269,13 +269,23 @@ func newRealtimeChannel(name string, client *Realtime, chOptions *channelOptions return c } +// RTL3 func (c *RealtimeChannel) onConnStateChange(change ConnectionStateChange) { + if change.Current == ConnectionStateConnected { + c.queue.Flush() //RTL3d + } + chState := c.State() + if chState != ChannelStateAttaching && chState != ChannelStateAttached { + return + } switch change.Current { - case ConnectionStateConnected: - c.queue.Flush() case ConnectionStateFailed: c.setState(ChannelStateFailed, change.Reason, false) c.queue.Fail(change.Reason) + case ConnectionStateClosed: + c.setState(ChannelStateDetached, nil, false) + case ConnectionStateSuspended: + c.setState(ChannelStateSuspended, nil, false) } } From f0a6f3dcf8a3cd2e3ddd32fb4f540521e7cfba7f Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Thu, 12 Sep 2024 11:31:09 +0530 Subject: [PATCH 2/2] Added missing spec annotations for RTL11 --- ably/realtime_client.go | 2 +- ably/realtime_presence.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ably/realtime_client.go b/ably/realtime_client.go index 56de739a..c37125ae 100644 --- a/ably/realtime_client.go +++ b/ably/realtime_client.go @@ -89,7 +89,7 @@ func (c *Realtime) onChannelMsg(msg *protocolMessage) { func (c *Realtime) onReconnected(failedResumeOrRecover bool) { for _, ch := range c.Channels.Iterate() { switch ch.State() { - // RTN15g3, RTN15c6, RTN15c7, RTN16l + // RTN15g3, RTN15c6, RTN15c7, RTN16l, RTL3d case ChannelStateAttaching, ChannelStateAttached, ChannelStateSuspended: ch.mayAttach(false) case ChannelStateDetaching: //RTN19b diff --git a/ably/realtime_presence.go b/ably/realtime_presence.go index e93192bd..c7f8be16 100644 --- a/ably/realtime_presence.go +++ b/ably/realtime_presence.go @@ -57,7 +57,7 @@ func (pres *RealtimePresence) isValidChannelState() error { } } -// RTP5a +// RTP5a, RTP16b, RTL11 func (pres *RealtimePresence) onChannelDetachedOrFailed(err error) { for k := range pres.members { delete(pres.members, k) @@ -68,7 +68,7 @@ func (pres *RealtimePresence) onChannelDetachedOrFailed(err error) { pres.queue.Fail(err) } -// RTP5f, RTP16b +// RTP5f, RTP16b, RTL11 func (pres *RealtimePresence) onChannelSuspended(err error) { pres.queue.Fail(err) }