HRC - double killConnection opens a new socket without disconnection

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

eyalb
Posts: 9
Joined: 08 Jan 2018, 10:13

HRC - double killConnection opens a new socket without disconnection

Postby eyalb » 09 Jan 2018, 09:13

Hi,

I'm testing HRC+ system.
When i'm doing a single killConnection call, everything seems to work well and as expected on client side. logs are:
logs are:
killConnection
onConnectionRetry
onConnectionResume

Problem starts when i'm simulating a double killConnection, meaning, another killConnection before getting to Resume (by the way - would be nice to hear how rare actually this case is, and if I can be neglected).
In this case, client logs are:
killConnection
onConnectionRetry
killConnection
onConnectionResume
onConnection (AGAIN, without any disconnection)

Seems like the serverside still sends messages on the old socket, that didn't disconnect, and there's a new socket on which client now sends messages. How can this case be handled? Basically, I wouldn't mind that in those cases the HRC+ will not kick in, and the client will experience a regular disconnection.

Client side is Objective-C API version 1.7.3.

Thanks!!
Eyal Barak
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: HRC - double killConnection opens a new socket without disconnection

Postby Lapo » 09 Jan 2018, 15:51

Hi,
I don't think it makes sense to double kill the connection. The situation is an extreme corner case. If the new connection gets insta-killed it will fail to restore the previous session. There's not much that can be done about it. The client must at least be able to exchange the handshake with the server.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
eyalb
Posts: 9
Joined: 08 Jan 2018, 10:13

Re: HRC - double killConnection opens a new socket without disconnection

Postby eyalb » 15 Jan 2018, 20:54

Hi,

Thanks for the response.
Is there a way to simulate a reconnection that takes a longer time? Let's say few seconds, or even towards 30 seconds (as my User reconnection timeframe is defined to). Those are scenarios I would like to test.. but the connection always resumes very fast after using killConnection.

Thanks!
Eyal
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: HRC - double killConnection opens a new socket without disconnection

Postby Lapo » 16 Jan 2018, 08:43

Yes, you will need to run client and server on separate machines and you'll need a firewall running on the client machine.

1) Launch the client and connect to SFS2X
2) Activate the firewall blocking the communication between client and SFS2X
3) Call killConnection()

At this point the client will attempt to reconnect but the firewall is denying the connection so the API will keep retrying until the timeout is reached or the firewall is turned off, allowing the reconnection to happen.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 7 guests