From 73903315a9615c2bbdcba23526298fc3f928a20f Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Mon, 7 Sep 2020 08:56:17 +0200 Subject: [PATCH] Handle "bye" proxy messages. --- src/signaling/mcu_proxy.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/signaling/mcu_proxy.go b/src/signaling/mcu_proxy.go index e9bb8a9..295cdfe 100644 --- a/src/signaling/mcu_proxy.go +++ b/src/signaling/mcu_proxy.go @@ -661,6 +661,8 @@ func (c *mcuProxyConnection) processMessage(msg *ProxyServerMessage) { c.processPayload(msg) case "event": c.processEvent(msg) + case "bye": + c.processBye(msg) default: log.Printf("Unsupported message received from %s: %+v", c.url, msg) } @@ -734,6 +736,17 @@ func (c *mcuProxyConnection) processEvent(msg *ProxyServerMessage) { log.Printf("Received event for unknown client %+v from %s", event, c.url) } +func (c *mcuProxyConnection) processBye(msg *ProxyServerMessage) { + bye := msg.Bye + switch bye.Reason { + case "session_resumed": + log.Printf("Session %s on %s was resumed by other client, resetting", c.sessionId, c.url) + c.sessionId = "" + default: + log.Printf("Received bye with unsupported reason from %s %+v", c.url, bye) + } +} + func (c *mcuProxyConnection) sendHello() error { c.helloMsgId = strconv.FormatInt(atomic.AddInt64(&c.msgId, 1), 10) msg := &ProxyClientMessage{