From 603309aeb5a4c8304dac86928cba26cafdfabf5e Mon Sep 17 00:00:00 2001 From: Felix Lipski Date: Fri, 15 Dec 2023 18:17:00 +0100 Subject: [PATCH] unixsoc depend on handshake-only --- cardano-cli/src/Cardano/CLI/Run/Ping.hs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/Run/Ping.hs b/cardano-cli/src/Cardano/CLI/Run/Ping.hs index b466f82ea8..caffac64e5 100644 --- a/cardano-cli/src/Cardano/CLI/Run/Ping.hs +++ b/cardano-cli/src/Cardano/CLI/Run/Ping.hs @@ -65,6 +65,7 @@ pingClient stdout stderr cmd = CNP.pingClient stdout stderr opts where opts = CNP.PingOpts { CNP.pingOptsQuiet = pingCmdQuiet cmd , CNP.pingOptsJson = pingCmdJson cmd + -- TODO: set to 0 when --handshake-only , CNP.pingOptsCount = pingCmdCount cmd , CNP.pingOptsHost = maybeHostEndPoint (pingCmdEndPoint cmd) , CNP.pingOptsUnixSock = maybeUnixSockEndPoint (pingCmdEndPoint cmd) @@ -145,14 +146,22 @@ pHost = , Opt.help "Hostname/IP, e.g. relay.iohk.example." ] +pHanshakeOnly :: Opt.Parser () +pHanshakeOnly = + ( Opt.flag' () $ mconcat + [ Opt.long "handshake-only" + , Opt.help "Perform only the handshake process without sending a ping." + ]) + pUnixSocket :: Opt.Parser String pUnixSocket = - Opt.strOption $ mconcat + pHanshakeOnly *> + ( Opt.strOption $ mconcat [ Opt.long "unixsock" , Opt.short 'u' , Opt.metavar "SOCKET" , Opt.help "Unix socket, e.g. file.socket." - ] + ]) pEndPoint :: Opt.Parser EndPoint pEndPoint = fmap HostEndPoint pHost <|> fmap UnixSockEndPoint pUnixSocket @@ -202,6 +211,9 @@ pPing = PingCmd <*> ( Opt.switch $ mconcat [ Opt.long "query-versions" , Opt.short 'Q' - , Opt.help "Query the supported protocol versions using the handshake protocol and terminate the connection." + , Opt.help $ mconcat + [ "Query the supported protocol versions using the handshake protocol and terminate the connection. " + , "(deprecated; use under --handshake-only instead)." + ] ] )