Surviving (some) disconnect scenarios

Moderator: keyser

Surviving (some) disconnect scenarios

Postby rootbeer23 » 29 Sep 2014, 05:05

This feature addresses the change of IP addresses due to
temporary failure of internet connections.
for example a mandatory disconnect after max 24 hours is
common in some parts of the world.
the issue then of course is that the various instances of
FA.exe try to communicate with the obsolete IP address in
vain.

how it works so far:

when you join a game, the FAForever client launches
FA.exe which then exchanges UDP packets with faforever.com
using a GPGnet protocol. Via this protocol FA.exe receives
information about the other peers in the game and then
starts exchanging UDP packets directly with the peers via
a different GPGnet protocol that is used during the game ("lobbyCom").
when the IP address of a peer changes, there is no mechanism
by which all others can stay up to date and the connection
is lost.

the solution is not complicated:

the player whose IP changed has to send updates to all peers
to inform them of the new address.
To facilitate this, all lobbyCom connections are proxied through
the FAForever client. That is, FA.exe talks to localhost:port
and the lobby sends the datagram to the real peers. The same
method is used for the current proxy with the difference that
the lobby does not send datagrams to the peers directly, but
to the central proxy server. To clarify: the central proxy
isnt involved in this feature. (to see what i am talking about,
search for "ConnectToProxy" in src/fa/relayserver.py)

First the lobby has to detect that the address has changed.
2 things have to be true: no data arrives from either the
peers or the server in a reasonable time.
In that case a new connection is made to the server via TCP
(falobby protocol). Optionally the server can confirm that
the IP address has changed indeed.
When the server is reachable again the lobby sends UDP
datagrams to all peers. those datagrams are received by
the remote lobbies, but are not forwarded to FA.exe.
And they do not conform to the lobbyCom protocol.
Since they come from a yet unknown sender IP, the lobby
can distinguish them from lobbyCom traffic.
The remote lobbies then retrieve the updated IP address
and exchange of lobbyCom messages can continue.

Bonus: since FA.exe only ever talks to localhost, IPv6 would
not be a problem.

changing IP address makes up 99% of disconnects for me,
the other 1% being BSOD or tripping over the power cable,
so i expect that it will address a significant portion
of problems.
EDIT: actually the distribution of all failure causes is approx
90% Ip change, 9% simulation freeze, 1% rest.

comments?
rootbeer23
Supreme Commander
 
Posts: 1001
Joined: 18 May 2012, 15:38
Has liked: 0 time
Been liked: 31 times
FAF User Name: root2342

Re: Surviving (some) disconnect scenarios

Postby Col_Walter_Kurtz » 01 Oct 2014, 17:20

Just commenting because I like the idea. No idea where you got your information or if it can actually be fixed though.
Col_Walter_Kurtz
Priest
 
Posts: 497
Joined: 28 Jul 2014, 10:42
Has liked: 42 times
Been liked: 45 times
FAF User Name: Apocalypse_Now

Re: Surviving (some) disconnect scenarios

Postby rootbeer23 » 01 Oct 2014, 22:01

_VODKA_ wrote:Just commenting because I like the idea. No idea where you got your information or if it can actually be fixed though.


nobody argued to the contrary, i take this as confirmation that it can be done like this and i will
do it in a little while.
its not forgotten or abandoned, no negative comments was all i was looking for.
the details of the connection procedure can be learned from wireshark dumps and the faf lobby code.
rootbeer23
Supreme Commander
 
Posts: 1001
Joined: 18 May 2012, 15:38
Has liked: 0 time
Been liked: 31 times
FAF User Name: root2342

Re: Surviving (some) disconnect scenarios

Postby Ze_PilOt » 01 Oct 2014, 22:37

Actually something similar MUST be done as FA doesn't support ipv6 : Everything must go through the lobby so FA only connect locally to the lobby.

Everything is in place (it's basically a local proxy server, you don't need to wireshark or anything, it's done), it needs some work to be complete. Once done, reconnection is another layer, but probably easier.
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt

Re: Surviving (some) disconnect scenarios

Postby rootbeer23 » 03 Oct 2014, 14:09

FAFlobby is going to need to listen for datagrams on port 6112 from other players.
FA.exe has to be put on another port.
is there a mechanism to do this automatically, or is everyone gonna have to do it manually?
rootbeer23
Supreme Commander
 
Posts: 1001
Joined: 18 May 2012, 15:38
Has liked: 0 time
Been liked: 31 times
FAF User Name: root2342

Re: Surviving (some) disconnect scenarios

Postby Phlegm » 03 Oct 2014, 15:25

I believe you can listen on localhost:6112 and LANIP/EXTIP:6112 seperately, even on Windows.

So you can make FAF listen on the external IP/ LAN IP, and forward packets to localhost:6112, where FA is listening.

I think.
Phlegm
Avatar-of-War
 
Posts: 59
Joined: 28 Aug 2013, 16:06
Has liked: 26 times
Been liked: 6 times
FAF User Name: Phlegm

Re: Surviving (some) disconnect scenarios

Postby rootbeer23 » 03 Oct 2014, 16:02

ordinarily that is true, but i dont think FA.exe binds to localhost since it needs to send packets
to other computers.
rootbeer23
Supreme Commander
 
Posts: 1001
Joined: 18 May 2012, 15:38
Has liked: 0 time
Been liked: 31 times
FAF User Name: root2342

Re: Surviving (some) disconnect scenarios

Postby rootbeer23 » 06 Oct 2014, 08:18

the forwarding through the FAFlobby works fine.
now i need somebody to debug the reconnect state machine.

1)
git clone https://github.com/faf5678/lobby.git
git checkout p2preconnect
2)
send me PM with your nick so i can stalk you on FAF.
rootbeer23
Supreme Commander
 
Posts: 1001
Joined: 18 May 2012, 15:38
Has liked: 0 time
Been liked: 31 times
FAF User Name: root2342

Re: Surviving (some) disconnect scenarios

Postby Dragonfire » 06 Oct 2014, 09:08

rootbeer23 wrote:the forwarding through the FAFlobby works fine.
now i need somebody to debug the reconnect state machine.

1)
git clone https://github.com/faf5678/lobby.git
git checkout p2preconnect
2)
send me PM with your nick so i can stalk you on FAF.


For normal players it is not easy to run faf from source ;)
I send you a pm as soon I am online^^
Are you online in the irc dev channel?
Nick: IDragonfire
My native language is not english, please correct me, because I want to improve my skills # Resource Overview
User avatar
Dragonfire
Evaluator
 
Posts: 559
Joined: 19 Dec 2013, 10:18
Has liked: 39 times
Been liked: 61 times
FAF User Name: Dragonfire

Re: Surviving (some) disconnect scenarios

Postby rootbeer23 » 07 Oct 2014, 17:57

Dragonfire wrote:Are you online in the irc dev channel?


no. sounds like a good place to recruit more beta testers. post relevant link.

i got it working between me and myself. (i have 2 computers...)
wouldnt hurt to have 1 or 2 more ppl to try it out.
rootbeer23
Supreme Commander
 
Posts: 1001
Joined: 18 May 2012, 15:38
Has liked: 0 time
Been liked: 31 times
FAF User Name: root2342

Next

Return to FAF Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest