Hi!
Am 26.05.2008 um 18:19 schrieb Florian Westphal:
@@ -575,13 +635,14 @@ Client_GetFromToken( CLIENT *Client, int
this looks a lot less efficient than it could be. luckily, it's called only once during a connection's lifetime, but if a connection has not been fully registered and logged in, than why not use the token (or a variation of it) as the hashtable's key?
As far is I understood this, the token is only relevant for remote servers. Alex can probably shed some light on this.
In any case, i think that we might later benefit from putting clients and servers in separate tables.
[...]
@@ -1062,18 +1118,14 @@ Generate_MyToken( CLIENT *Client )
this function could also stand to use some help from caching. it seems raucously inefficient.
Perhaps Alex can explain what this number is about, and what its requirements are....
Tokens (c->token, c->mytoken) are only used for servers, right. They are only valid between to directly linked servers, and used to identify other introduced servers, to describe the topology of the network (SJOIN command), and to identify which client is connected to which server.
So Scott is right, Generate_MyToken() is definitely inefficient, but is only called when a new server is introduced and therefore shouldn't do so much harm during "normal operation", I think.
The token has to be an unique integer. 1 is always the local server, therefore Generate_MyToken() starts with 2.
Regards Alex