Skip to content

Commit e2381c8

Browse files
committed
remote: less chatty server
1 parent 3dc7ab6 commit e2381c8

File tree

1 file changed

+9
-6
lines changed
  • hnix-store-remote/src/System/Nix/Store/Remote

1 file changed

+9
-6
lines changed

hnix-store-remote/src/System/Nix/Store/Remote/Server.hs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ type WorkerHelper m
4242
)
4343
=> StoreRequest a -> m a
4444

45+
chatty :: Bool
46+
chatty = False
47+
48+
dbg :: MonadIO m => Text -> m ()
49+
dbg = when chatty . liftIO . Data.Text.IO.putStrLn
50+
4551
-- | Run an emulated nix daemon on given socket address.
4652
-- The deamon will close when the continuation returns.
4753
runProxyDaemon
@@ -57,12 +63,12 @@ runProxyDaemon
5763
runProxyDaemon workerHelper postGreet lsock k = do
5864
liftIO $ listen lsock maxListenQueue
5965

60-
liftIO $ Data.Text.IO.putStrLn "listening"
66+
dbg "listening"
6167

6268
let listener :: m Void
6369
listener = do
6470
(sock, _) <- liftIO $ accept lsock
65-
liftIO $ Data.Text.IO.putStrLn "accepting"
71+
dbg "accepting"
6672

6773
-- TODO: this, but without the space leak
6874
fmap fst
@@ -160,7 +166,7 @@ processConnection workerHelper postGreet sock = do
160166
loop
161167
loop
162168

163-
liftIO $ Data.Text.IO.putStrLn "daemon connection done"
169+
dbg "daemon connection done"
164170
liftIO $ close sock
165171

166172
where
@@ -176,7 +182,6 @@ processConnection workerHelper postGreet sock = do
176182
RemoteStoreError_SerializerHandshake
177183
workerMagic
178184

179-
liftIO $ print ("magic" :: Text, magic)
180185
when (magic /= WorkerMagic_One)
181186
$ throwError
182187
$ RemoteStoreError_WorkerException
@@ -195,8 +200,6 @@ processConnection workerHelper postGreet sock = do
195200

196201
let leastCommonVersion = min clientVersion serverHandshakeInputOurVersion
197202

198-
liftIO $ print ("Versions client, min" :: Text, clientVersion, leastCommonVersion)
199-
200203
when (clientVersion < ProtoVersion 1 10)
201204
$ throwError
202205
$ RemoteStoreError_WorkerException

0 commit comments

Comments
 (0)