Skip to content

Commit f5cef25

Browse files
committed
build: move type to client_library module
1 parent 77a5ed2 commit f5cef25

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/Simplex/Messaging/Server/Prometheus.hs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Data.Time.Clock.System (systemEpochDay)
1313
import Data.Time.Format.ISO8601 (iso8601Show)
1414
import Network.Socket (ServiceName)
1515
import Simplex.Messaging.Server.Stats
16+
import Simplex.Messaging.Transport.Server (SocketStats (..))
1617

1718
data ServerMetrics = ServerMetrics
1819
{ statsData :: ServerStatsData,
@@ -32,13 +33,6 @@ data RealTimeMetrics = RealTimeMetrics
3233
ntfSubClientsCount :: Int
3334
}
3435

35-
data SocketStats = SocketStats
36-
{ socketsAccepted :: Int,
37-
socketsClosed :: Int,
38-
socketsActive :: Int,
39-
socketsLeaked :: Int
40-
}
41-
4236
{-# FOURMOLU_DISABLE\n#-}
4337
prometheusMetrics :: ServerMetrics -> RealTimeMetrics -> UTCTime -> Text
4438
prometheusMetrics sm rtm ts =

src/Simplex/Messaging/Transport/Server.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module Simplex.Messaging.Transport.Server
1212
runTransportServerState,
1313
runTransportServerState_,
1414
SocketState,
15+
SocketStats (..),
1516
newSocketState,
1617
getSocketStats,
1718
runTransportServer,
@@ -44,7 +45,6 @@ import Foreign.C.Error
4445
import GHC.IO.Exception (ioe_errno)
4546
import Network.Socket
4647
import qualified Network.TLS as T
47-
import Simplex.Messaging.Server.Prometheus
4848
import Simplex.Messaging.Transport
4949
import Simplex.Messaging.Util (catchAll_, labelMyThread, tshow)
5050
import System.Exit (exitFailure)
@@ -165,6 +165,13 @@ safeAccept sock =
165165

166166
type SocketState = (TVar Int, TVar Int, TVar (IntMap (Weak ThreadId)))
167167

168+
data SocketStats = SocketStats
169+
{ socketsAccepted :: Int,
170+
socketsClosed :: Int,
171+
socketsActive :: Int,
172+
socketsLeaked :: Int
173+
}
174+
168175
newSocketState :: IO SocketState
169176
newSocketState = (,,) <$> newTVarIO 0 <*> newTVarIO 0 <*> newTVarIO mempty
170177

0 commit comments

Comments
 (0)