From 4194409682e5ef2e0c7ce7e38df94f41f2f1d2ee Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Fri, 13 Sep 2019 18:43:35 +0200 Subject: [PATCH] remove another message to make network tests more reliable --- libs/network/Echo.idr | 9 ++------- libs/network/expected | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/libs/network/Echo.idr b/libs/network/Echo.idr index b5a5a24..f65225c 100644 --- a/libs/network/Echo.idr +++ b/libs/network/Echo.idr @@ -33,12 +33,6 @@ runServer = do putStrLn ("Received: " ++ str) Right n <- send s ("echo: " ++ str) | Left err => putStrLn ("Server failed to send data with error: " ++ show err) - -- This might be printed either before or after the client prints - -- what it's received, and I think there's enough to check it's - -- working without this message so I've removed it. If you disagree, - -- please put it back, but also please make sure it's synchronised - -- such that the messages are always printed in the same order. - EB - -- putStrLn ("Server sent " ++ show n ++ " bytes") pure () runClient : Port -> IO () @@ -51,9 +45,10 @@ runClient serverPort = do else do Right n <- send sock ("hello world!") | Left err => putStrLn ("Client failed to send data with error: " ++ show err) - putStrLn ("Client sent " ++ show n ++ " bytes") Right (str, _) <- recv sock 1024 | Left err => putStrLn ("Client failed to receive on socket with error: " ++ show err) + -- assuming that stdout buffers get flushed in between system calls, this is "guaranteed" + -- to be printed after the server prints its own message putStrLn ("Received: " ++ str) main : IO () diff --git a/libs/network/expected b/libs/network/expected index cc2b2c3..92aad5a 100644 --- a/libs/network/expected +++ b/libs/network/expected @@ -1,3 +1,2 @@ -Client sent 12 bytes Received: hello world! Received: echo: hello world!