Opened 8 years ago

Last modified 3 years ago

#3953 closed enhancement

[PATCH] Network cleanup - IP address conversion — at Initial Version

Reported by: elexis Owned by:
Priority: Nice to Have Milestone: Alpha 21
Component: Network Keywords: patch
Cc: Patch:

Description

  • This patch was done because leper didn't like r17772 (#2854) converting the IP-address from a 32bit number to a string and then comparing that against 127.0.0.1. (I'm not convinced this is less elegant than the proposed patch changing the protocol). The function GetIPAddress() is thus deleted (might be introduced for other purposes later like showing IPs in the GUI). The other GetIPAddress() was introduced in r17217 (#3241) and has the same issue, can be removed in a follow-up patch.
  • Previously, the timeouts were disabled if the IP is 127.0.0.1. Now it is disabled only if the server and client are started from the same process, thus working better in some edgecases when clients for example connect via a reverse proxy and thus also had 127.0.0.1.
  • To avoid accessing globals the g_NetServer and g_NetClient from inside the others thread (thread safety), the client now needs to inform the server that it is running in the same process, which is now transmitted on authentication.
  • There are no security measures taken to prevent arbitrary clients from setting that disableTimeout flag to true, but could be implemented trivially by changing the boolean that is transmitted via network to a shared secret.
  • The compiler didn't want to consume a default argument for the ctor of CNetClient, thus changes all occurances where it is instantiated.
  • Notice m_HostGUID is only used to prevent the host client from kicking itself.

Change History (2)

by elexis, 8 years ago

Renames the new variable to isLocalClient, replaces g_HostGUID and changes the other mentioned GetIPAddress function to not convert to string.

Note: See TracTickets for help on using tickets.