mldonkey-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-users] [patch #4776] EDK: Avoid LowID if max_indirect_connecti


From: z
Subject: [Mldonkey-users] [patch #4776] EDK: Avoid LowID if max_indirect_connections is reached
Date: Sun, 8 Jan 2006 20:38:49 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Follow-up Comment #1, patch #4776 (project mldonkey):

You are re-calculating what I would call 
'real_max_indirect_connections' each and
every time you use it, based on a percent 
of max_connections.  

(!!max_opened_connections * !!max_indirect_connections / 100);

Why not calculate it just once and use the 
result directly?

This value can only change when max_connections 
and max_indirect_connections change, so perhaps 
adding a function "calc_real_max" on those two 
options as hooks would be better than recalculating 
the same thing all the time.

let calc_real_max () =
 !real_max := !!max_opened_connections * !!max_indirect_connections / 100;

You also re-check if an IP is blocked a bunch of 
times.  An ip is blocked or it isn't and rechecking 
against the blocked list is not cheap. 
let is_ip_blocked = Ip_set.ip_blocked from_ip in 
... and then reusing "is_ip_blocked" seems better.

Hardcoding IP addresses is always a bad idea, 
especially when it is embedded like this...

Also, you are accepting anyone in the server address 
list to gain an indirect connection at any time.
If I run Bob's TinyServer and get my server address 
into all mldonkey server lists, I can get indirect 
connections at all times avoiding the connection limit.  
Wouldn't it be better to accept a server address (and 
perhaps matching only the first three octets of the 
quad address like 195.245.244.* to get around your 
razorback problem) _only_ if the server is in the 
'Connecting' state?  (I assume it is in this state 
while trying to establish a connection)


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?func=detailitem&item_id=4776>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]