diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2021-12-16 21:30:06 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2021-12-16 21:30:06 +0100 |
commit | c1fff94d244d6754a0976d0385d4333249fc5ca6 (patch) | |
tree | 2be7e32d674e2ca87660ad03d281772ad9cbd87a /src/Main.hs | |
parent | 9e07f08c019a4951fff0a969ca3fb88c8a0d9569 (diff) |
Remove unnecessary self identity parameters
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/Main.hs b/src/Main.hs index 8d6f8de..fcdb2c5 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -296,7 +296,6 @@ cmdUpdateIdentity = void $ do cmdAttach :: Command cmdAttach = join $ attachToOwner <$> asks ciPrint - <*> asks (headLocalIdentity . ciHead) <*> (maybe (throwError "no peer selected") return =<< gets csPeer) cmdAttachAccept :: Command @@ -318,7 +317,6 @@ cmdContacts = do cmdContactAdd :: Command cmdContactAdd = join $ contactRequest <$> asks ciPrint - <*> asks (headLocalIdentity . ciHead) <*> (maybe (throwError "no peer selected") return =<< gets csPeer) cmdContactAccept :: Command @@ -329,7 +327,6 @@ cmdContactAccept = join $ contactAccept cmdDiscoveryInit :: Command cmdDiscoveryInit = void $ do - self <- asks (headLocalIdentity . ciHead) server <- asks ciServer (hostname, port) <- (words <$> asks ciLine) >>= return . \case @@ -338,20 +335,19 @@ cmdDiscoveryInit = void $ do [] -> ("discovery.erebosprotocol.net", show discoveryPort) addr:_ <- liftIO $ getAddrInfo (Just $ defaultHints { addrSocketType = Datagram }) (Just hostname) (Just port) peer <- liftIO $ serverPeer server (addrAddress addr) - sendToPeer self peer $ DiscoverySelf (T.pack "ICE") 0 + sendToPeer peer $ DiscoverySelf (T.pack "ICE") 0 modify $ \s -> s { csIcePeer = Just peer } cmdDiscovery :: Command cmdDiscovery = void $ do Just peer <- gets csIcePeer - self <- asks (headLocalIdentity . ciHead) st <- asks (storedStorage . headStoredObject . ciHead) sref <- asks ciLine eprint <- asks ciPrint liftIO $ readRef st (BC.pack sref) >>= \case Nothing -> error "ref does not exist" Just ref -> do - res <- runExceptT $ sendToPeer self peer $ DiscoverySearch ref + res <- runExceptT $ sendToPeer peer $ DiscoverySearch ref case res of Right _ -> return () Left err -> eprint err |