From 7d99c4b35cf2dc531219bc83146b714c9bae429c Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Wed, 3 Aug 2022 09:59:49 +0100 Subject: [PATCH] reconnect agent clients on any network config change (#489) * reconnect agent clients on any network config change * add Eq instances --- src/Simplex/Messaging/Agent.hs | 2 +- src/Simplex/Messaging/Client.hs | 2 +- src/Simplex/Messaging/Transport/KeepAlive.hs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Simplex/Messaging/Agent.hs b/src/Simplex/Messaging/Agent.hs index 9ca396f23..92d794941 100644 --- a/src/Simplex/Messaging/Agent.hs +++ b/src/Simplex/Messaging/Agent.hs @@ -213,7 +213,7 @@ setNetworkConfig :: AgentErrorMonad m => AgentClient -> NetworkConfig -> m () setNetworkConfig c cfg' = do cfg <- atomically $ do swapTVar (useNetworkConfig c) cfg' - liftIO . when (socksProxy cfg /= socksProxy cfg') $ do + liftIO . when (cfg /= cfg') $ do closeProtocolServerClients c smpClients closeProtocolServerClients c ntfClients diff --git a/src/Simplex/Messaging/Client.hs b/src/Simplex/Messaging/Client.hs index c4ff7179e..06b6a8530 100644 --- a/src/Simplex/Messaging/Client.hs +++ b/src/Simplex/Messaging/Client.hs @@ -127,7 +127,7 @@ data NetworkConfig = NetworkConfig -- | period for SMP ping commands (microseconds) smpPingInterval :: Int } - deriving (Show, Generic, FromJSON) + deriving (Eq, Show, Generic, FromJSON) instance ToJSON NetworkConfig where toJSON = J.genericToJSON J.defaultOptions {J.omitNothingFields = True} diff --git a/src/Simplex/Messaging/Transport/KeepAlive.hs b/src/Simplex/Messaging/Transport/KeepAlive.hs index e54441dd5..35ef21fb5 100644 --- a/src/Simplex/Messaging/Transport/KeepAlive.hs +++ b/src/Simplex/Messaging/Transport/KeepAlive.hs @@ -17,7 +17,7 @@ data KeepAliveOpts = KeepAliveOpts keepIntvl :: Int, keepCnt :: Int } - deriving (Show, Generic, FromJSON) + deriving (Eq, Show, Generic, FromJSON) instance ToJSON KeepAliveOpts where toEncoding = J.genericToEncoding J.defaultOptions