From 27b8fb9f400c2d007909b996021d9f5364a2fea8 Mon Sep 17 00:00:00 2001 From: Dmitry Zuikov Date: Thu, 25 May 2023 13:19:34 +0300 Subject: [PATCH] trying to close tcp stuff on respawn --- hbs2-core/lib/HBS2/Net/Messaging/TCP.hs | 2 ++ hbs2-peer/app/PeerMain.hs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hbs2-core/lib/HBS2/Net/Messaging/TCP.hs b/hbs2-core/lib/HBS2/Net/Messaging/TCP.hs index bf19be3f..560ed82d 100644 --- a/hbs2-core/lib/HBS2/Net/Messaging/TCP.hs +++ b/hbs2-core/lib/HBS2/Net/Messaging/TCP.hs @@ -422,10 +422,12 @@ runMessagingTCP env = liftIO do liftIO ( listen (Host (show i)) (show p) $ \(sock, sa) -> do + withFdSocket sock setCloseOnExecIfNeeded debug $ "Listening on" <+> pretty sa forever do void $ acceptFork sock $ \(so, remote) -> do + withFdSocket so setCloseOnExecIfNeeded trace $ "GOT INCOMING CONNECTION FROM" <+> brackets (pretty own) <+> brackets (pretty sa) diff --git a/hbs2-peer/app/PeerMain.hs b/hbs2-peer/app/PeerMain.hs index 9218ff7b..19b34cb0 100644 --- a/hbs2-peer/app/PeerMain.hs +++ b/hbs2-peer/app/PeerMain.hs @@ -267,7 +267,7 @@ runCLI = join . customExecParser (prefs showHelpOnError) $ c <- optional confOpt - resp <- optional $ flag' True ( long "respawn" <> short 'r' <> help "respawn process") + resp <- optional $ flag' True ( long "respawn" <> short 'R' <> help "respawn process") pure $ PeerOpts pref l r k c resp