CardsAgainst icon indicating copy to clipboard operation
CardsAgainst copied to clipboard

Re-connect peers after leaving app

Open coopersita opened this issue 9 years ago • 4 comments

I know this is probably an underlying issue with the MPC framework, but I was wondering if there is a way in which users that leave the game (check email, answer a text or phone call), and then come back can be re-connected.

coopersita avatar Mar 01 '15 22:03 coopersita

This definitely sounds like more of a bug in CardsAgainst rather than MPC. Feel free to file a PR if you can fix this.

jpsim avatar Mar 01 '15 22:03 jpsim

I was just looking at this issue with some code I found on the web. When the user logs off, and reopens, a new instance of the MPC is created and so essentially there's a memory leak because the old instance doesn't release automatically. Apple gives a workaround at 32:00 in this video: https://developer.apple.com/videos/play/wwdc2014/709/. There might have been more on this in other videos too from wwdc2013.

Basically, if you persist the data like the PeerID using NSKeyedArchiver, you can have the app remember who it lost a connection to so that you're not constantly re-instantiating new MPC channels. Was going to eventually add this to some code I found by Ralph Ebert on MPCs.

ryan2clw avatar Mar 15 '16 18:03 ryan2clw

Hey @jpsim has this bug been fixed? I wanna take a crack at doing @ryan2clw recommendation

lgdelacruz92 avatar Jan 18 '18 02:01 lgdelacruz92

I don't think anything's been done regarding this. If you can reproduce an issue, then you're in an ideal place to improve it!

jpsim avatar Jan 19 '18 05:01 jpsim