@@ -399,7 +399,7 @@ apiClose theirEndPoint connId connAlive = void . tryIO $ do
399399 then do
400400 writeIORef connAlive False
401401 sendOn vst [encodeInt32 CloseConnection, encodeInt32 connId]
402− return (RemoteEndPointValid . (remoteOutgoing ^: (+ 1)) $ vst)
402+ return (RemoteEndPointValid . (remoteOutgoing ^: (\x -> x - 1)) $ vst)
403403 else
404404 return (RemoteEndPointValid vst)
405405 RemoteEndPointClosed -> do
@@ -598,7 +598,7 @@ requestConnectionTo ourEndPoint theirAddress = go
598598 let failureHandler :: IOException -> IO b
599599 failureHandler err = do
600600 modifyMVar_ theirState $ \(RemoteEndPointValid ep) ->
601− return (RemoteEndPointValid . (remoteOutgoing ^: (+ 1)) $ ep)
601+ return (RemoteEndPointValid . (remoteOutgoing ^: (\x -> x - 1)) $ ep)
602602 -- TODO: should we call closeIfUnused here?
603603 throw $ TransportError ConnectFailed (show err)
604604