mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 03:37:49 +02:00
Don't use reversed port for choise random port. (by whothefuckami)
This commit is contained in:
parent
03111ad0df
commit
9e0c5d67c7
3 changed files with 24 additions and 1 deletions
|
@ -202,7 +202,13 @@ namespace i2p
|
|||
|
||||
uint16_t RouterContext::SelectRandomPort () const
|
||||
{
|
||||
uint16_t port = rand () % (30777 - 9111) + 9111; // I2P network ports range
|
||||
uint16_t port;
|
||||
do
|
||||
{
|
||||
port = rand () % (30777 - 9111) + 9111; // I2P network ports range
|
||||
}
|
||||
while(i2p::util::net::IsPortInReservedRange(port));
|
||||
|
||||
if (port == 9150) port = 9151; // Tor browser
|
||||
return port;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue