mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 00:13:12 +03:00
natpmp: formatting and cleanup old pmp handle
This commit is contained in:
parent
15f0df81f1
commit
8255fc0e8c
@ -75,7 +75,7 @@ maxRetries = 3
|
|||||||
|
|
||||||
-- How long to wait between retries.
|
-- How long to wait between retries.
|
||||||
networkRetryDelay :: Int
|
networkRetryDelay :: Int
|
||||||
networkRetryDelay = 5 * 1000000
|
networkRetryDelay = 5 * 1_000_000
|
||||||
|
|
||||||
-- Messages sent from the main thread to the port mapping communication thread.
|
-- Messages sent from the main thread to the port mapping communication thread.
|
||||||
data PortThreadMsg
|
data PortThreadMsg
|
||||||
@ -172,6 +172,7 @@ portThread q stderr = do
|
|||||||
displayShow ("port: sending initial request to NAT-PMP for port ", p)
|
displayShow ("port: sending initial request to NAT-PMP for port ", p)
|
||||||
setPortMapping pmp PTUdp p p portLeaseLifetime >>= \case
|
setPortMapping pmp PTUdp p p portLeaseLifetime >>= \case
|
||||||
Left err | isResetAndRetry err -> do
|
Left err | isResetAndRetry err -> do
|
||||||
|
closeNatPmp pmp
|
||||||
attemptReestablishNatPmpThen (\pmp -> handlePTM pmp msg nextRenew)
|
attemptReestablishNatPmpThen (\pmp -> handlePTM pmp msg nextRenew)
|
||||||
Left err -> do
|
Left err -> do
|
||||||
logError $
|
logError $
|
||||||
@ -208,6 +209,7 @@ portThread q stderr = do
|
|||||||
p)
|
p)
|
||||||
setPortMapping pmp PTUdp p p portLeaseLifetime >>= \case
|
setPortMapping pmp PTUdp p p portLeaseLifetime >>= \case
|
||||||
Left err | isResetAndRetry err -> do
|
Left err | isResetAndRetry err -> do
|
||||||
|
closeNatPmp pmp
|
||||||
attemptReestablishNatPmpThen (\pmp -> handleRenew pmp nextRenew)
|
attemptReestablishNatPmpThen (\pmp -> handleRenew pmp nextRenew)
|
||||||
Left err -> do
|
Left err -> do
|
||||||
logError $
|
logError $
|
||||||
|
Loading…
Reference in New Issue
Block a user