diff options
Diffstat (limited to 'src/Ssb/Peer')
-rw-r--r-- | src/Ssb/Peer/RPC.hs | 12 | ||||
-rw-r--r-- | src/Ssb/Peer/RPC/Gossip.hs | 2 | ||||
-rw-r--r-- | src/Ssb/Peer/RPC/Room.hs | 8 | ||||
-rw-r--r-- | src/Ssb/Peer/TCP.hs | 6 |
4 files changed, 9 insertions, 19 deletions
diff --git a/src/Ssb/Peer/RPC.hs b/src/Ssb/Peer/RPC.hs index e5a4c9a..3286a33 100644 --- a/src/Ssb/Peer/RPC.hs +++ b/src/Ssb/Peer/RPC.hs @@ -358,7 +358,7 @@ withM demuxer handler = with <$> demuxer <*> handler logMsg :: ConnState -> Text -> IO () logMsg conn msg = do _ <- atomically $ takeTMVar (lock conn) - print msg + putStrLn msg atomically $ putTMVar (lock conn) True logDebug :: ConnState -> Text -> IO () @@ -406,13 +406,9 @@ connect boxConn handler peer client = do forkIO $ -- make RPC calls on the peer client conn - print "entering service loop" ret <- serviceLoop conn - print "out of service loop" _ <- notifyDisconnect handler (connPeer conn) - print "disconnecting" disconnect conn - print "disconnected" return ret where serviceLoop conn = do @@ -564,15 +560,15 @@ handleMessage handler conn msg = do putTMVar (streamsIn conn) table' return . return $ () case err of - Left msg -> do - print msg + Left err -> do + putStrLn err return False Right _ -> do -- Serving a request call, how do we close it nicely? let endpoint = Endpoint (name req) (typ req) spawnConnection stream $ (serve handler) endpoint (args req) stream return True - where errTooManyRequests = "connection limit reached, dropping request" + where errTooManyRequests = "connection limit reached, dropping request" :: Text demux conn msg = do let reqNum = requestNumber . header $ msg diff --git a/src/Ssb/Peer/RPC/Gossip.hs b/src/Ssb/Peer/RPC/Gossip.hs index b97e4a4..80e1aac 100644 --- a/src/Ssb/Peer/RPC/Gossip.hs +++ b/src/Ssb/Peer/RPC/Gossip.hs @@ -115,7 +115,7 @@ writeFeed stream (Feed.Feed _ msgs) = do (\msg -> do let msg' = Feed.encodeJSONVerifiableMessage msg err <- RPC.writeStream stream def (RPC.JSONPayload msg') - either (\err -> print err) (\_ -> return ()) err + either (\err -> putStrLn err) (\_ -> return ()) err ) instance ToJSON a => RPC.Handler (Gossiper a) where diff --git a/src/Ssb/Peer/RPC/Room.hs b/src/Ssb/Peer/RPC/Room.hs index 47bc956..0b85414 100644 --- a/src/Ssb/Peer/RPC/Room.hs +++ b/src/Ssb/Peer/RPC/Room.hs @@ -149,7 +149,6 @@ fork mVar action = do forkFinally action (\_ -> do - print "exiting fork" atomically $ putTMVar fork' () ) @@ -185,11 +184,6 @@ createTunnel :: Room -> (RPC.Stream, RPC.Stream) -> IO (Either Text ()) createTunnel room (stream1, stream2) = do let peer1 = RPC.connPeer $ RPC.conn stream1 let peer2 = RPC.connPeer $ RPC.conn stream2 - --print - -- $ "creating tunnel for " - -- <> Ssb.formatPublicKey peer1 - -- <> " <-> " - -- <> Ssb.formatPublicKey peer2 let tunnel = newTunnel peer1 peer2 exists <- atomically $ do @@ -243,7 +237,7 @@ connect room stream req = do maybeToRight errPeerNotAvailable mPeer case peerConn of Left err -> do - print $ "errorr! " <> err + putStrLn $ "room error: " <> err return $ Left err Right conn -> RPC.request conn (rpcRequest req) $ \peerStream -> createTunnel room (stream, peerStream) diff --git a/src/Ssb/Peer/TCP.hs b/src/Ssb/Peer/TCP.hs index 27e3f07..59d7f81 100644 --- a/src/Ssb/Peer/TCP.hs +++ b/src/Ssb/Peer/TCP.hs @@ -51,12 +51,12 @@ serveBoxStream host port networkID id cmd = networkID id case res of - Left err -> print $ "client handshake error: " <> err + Left err -> putStrLn $ "client handshake error: " <> err Right sharedSecrets -> do let peerID = (fromMaybe undefined $ SH.secretA sharedSecrets) conn <- BoxStream.connectServer socket sharedSecrets case conn of - Left err -> print $ "client error: " <> err + Left err -> putStrLn $ "client error: " <> err Right conn -> cmd conn (Ssb.Identity Nothing peerID) connectRPC @@ -96,5 +96,5 @@ serveRPC handler host port networkID id = serveBoxStream host port networkID id $ \conn peer -> do res <- RPC.connect conn handler (Ssb.publicKey peer) (\_ -> return ()) case res of - Left err -> print $ "RPC error serving client: " <> err + Left err -> putStrLn $ "RPC error serving client: " <> err Right _ -> return () |