Increment server port if already in use

parent 7221f9a4
......@@ -318,13 +318,15 @@ Forward !my-addr ( -- )
Variable net2o-host "net2o.de" net2o-host $!
: net2o-socket ( port -- ) dup >r
ipv6( ipv4( [IFDEF] no-hybrid
create-udp-server6 [ELSE] create-udp-server46 [THEN]
)else( create-udp-server6 )
)else( create-udp-server )
: net2o-socket ( port -- )
BEGIN [: dup
ipv6( ipv4( [IFDEF] no-hybrid
create-udp-server6 [ELSE] create-udp-server46 [THEN]
)else( create-udp-server6 )
)else( create-udp-server )
;] catch WHILE 1+ REPEAT
[IFDEF] no-hybrid 0 [THEN] to net2o-sock
r> ?dup-0=-IF my-port THEN to my-port#
?dup-0=-IF my-port THEN to my-port#
[IFDEF] no-hybrid
ipv4( net2o-sock drop my-port# create-udp-server to net2o-sock )
[THEN]
......
......@@ -1015,16 +1015,19 @@ in net2o : punch ( addr u o:connection -- )
ELSE 2drop THEN ;
: pings ( o:connection -- )
\G ping all addresses except the first one
punch-addrs $@ ( cell safe/string ) bounds ?DO
\G ping all addresses (why except the first one?)
punch-addrs $@ cell safe/string bounds ?DO
I @ ['] ping-addr1 addr>sock
cell +LOOP ;
: punchs ( addr u o:connection -- )
\G send a reply to all addresses
\ ret-addr $10 $make { w^ ret }
punch-addrs $@ bounds ?DO
I @ ['] send-punch addr>sock
cell +LOOP 2drop ;
cell +LOOP 2drop
\ ret $@ ret-addr swap move ret $free
;
\ send chunk
......
......@@ -455,4 +455,3 @@ the balance command, which balances the selected asset.
The signature of a contract signs the wallet's state (serialized in
normalized form) after the contract has been executed. The current
contract's hash is part of the serialization.
chatgroups: list chatgroups
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment