@@ -54,7 +54,6 @@ lookupSession :: SessionID -> ConnectionM (Maybe Session)
54
54
lookupSession sessionID = do
55
55
tableRef <- getSessionTableRef
56
56
table <- liftIO (readIORef tableRef)
57
- -- debug Debug $ sessionID <> " [Session] Lookup"
58
57
return (H. lookup sessionID table)
59
58
60
59
--------------------------------------------------------------------------------
@@ -99,8 +98,8 @@ handleConnection (Handshake, _) = do
99
98
100
99
-- session table management
101
100
updateSession (H. insert sessionID session)
102
- debugLog Debug session " [Session] Created"
103
- debugLog Debug session " [Request] Handshake"
101
+ logWithSessionID Debug sessionID " [Session] Created"
102
+ logWithSessionID Debug sessionID " [Request] Handshake"
104
103
105
104
-- timeout
106
105
setTimeout session
@@ -121,45 +120,45 @@ handleConnection (Handshake, _) = do
121
120
return $ Session sessionID Connecting channelHub listeners timeoutVar
122
121
123
122
handleConnection (Connect sessionID, Just (session, Connecting )) = do
124
- debugLog Debug session " [Request] Connect: ACK"
123
+ logWithSessionID Debug sessionID " [Request] Connect: ACK"
125
124
extendTimeout session
126
125
let session' = session { sessionState = Connected }
127
126
updateSession (H. insert sessionID session')
128
127
runSession SessionConnect session'
129
128
130
- handleConnection (Connect _ , Just (session, Connected )) = do
131
- debugLog Debug session " [Request] Connect: Polling"
129
+ handleConnection (Connect sessionID , Just (session, Connected )) = do
130
+ logWithSessionID Debug sessionID " [Request] Connect: Polling"
132
131
extendTimeout session
133
132
runSession SessionPolling session
134
133
135
134
handleConnection (Connect sessionID, Nothing ) = do
136
- debug Warn $ sessionID <> " [Request] Connect: Session not found"
135
+ logWithSessionID Warn sessionID " [Request] Connect: Session not found"
137
136
return $ MsgError NoEndpoint NoData
138
137
139
138
handleConnection (Disconnect sessionID, Just (session, _)) = do
140
- debugLog Debug session " [Request] Disconnect: By client"
139
+ logWithSessionID Debug sessionID " [Request] Disconnect: By client"
141
140
clearTimeout session
142
141
updateSession (H. delete sessionID)
143
- debugLog Debug session " [Session] Destroyed"
142
+ logWithSessionID Debug sessionID " [Session] Destroyed"
144
143
runSession SessionDisconnectByClient session
145
144
146
145
handleConnection (Disconnect sessionID, Nothing ) = do
147
- debug Warn $ sessionID <> " [Request] Disconnect: Session not found"
146
+ logWithSessionID Warn sessionID " [Request] Disconnect: Session not found"
148
147
return MsgNoop
149
148
150
- handleConnection (Emit _ _, Just (session, Connecting )) = do
149
+ handleConnection (Emit sessionID _, Just (session, Connecting )) = do
151
150
extendTimeout session
152
- debugLog Warn session " [Request] Emit: Session still connecting, not ACKed"
151
+ logWithSessionID Warn sessionID " [Request] Emit: Session still connecting, not ACKed"
153
152
return $ MsgError NoEndpoint NoData
154
153
155
- handleConnection (Emit _ event@ (Event eventName (Payload payloads)), Just (session, Connected )) = do
156
- debugLog Debug session $ " [Request] Emit: " <> serialize eventName <> " " <> serialize payloads
154
+ handleConnection (Emit sessionID event@ (Event eventName (Payload payloads)), Just (session, Connected )) = do
155
+ logWithSessionID Debug sessionID $ " [Request] Emit: " <> serialize eventName <> " " <> serialize payloads
157
156
runSession (SessionEmit event) session
158
157
159
- handleConnection (Emit _ NoEvent , Just (session , Connected )) = do
160
- debugLog Warn session $ " [Request] Emit: event malformed"
158
+ handleConnection (Emit sessionID NoEvent , Just (_ , Connected )) = do
159
+ logWithSessionID Warn sessionID " [Request] Emit: event malformed"
161
160
return $ MsgError NoEndpoint NoData
162
161
163
162
handleConnection (Emit sessionID _, Nothing ) = do
164
- debug Warn $ sessionID <> " [Request] Emit: Session not found"
163
+ logWithSessionID Warn sessionID " [Request] Emit: Session not found"
165
164
return $ MsgError NoEndpoint NoData
0 commit comments