zeroc-ice / ice-demos

Sample programs for Ice
https://zeroc.com
GNU General Public License v2.0
325 stars 217 forks source link

Swift chat demo threading issue #89

Closed bernardnormier closed 5 years ago

bernardnormier commented 5 years ago

When the connection drops, the Swift Chat demo calls self.closed:

if let conn = router!.ice_getCachedConnection() {
            conn.setACM(timeout: acmTimeout, close: nil, heartbeat: .HeartbeatAlways)

            do {
                try conn.setCloseCallback { _ in
                    self.closed()
                }
            } catch {}
        }

Threading wise, this is not correct since self.closed executes in the Ice client thread pool thread / dispatch queue and calls directly UI elements.