|
|
|
@ -124,12 +124,13 @@ notificationThread clientIdentity callbacks ctx ep idCounter cmdVar killMv secPa |
|
|
|
resp <- takeMVar respVar |
|
|
|
resp <- takeMVar respVar |
|
|
|
case resp of |
|
|
|
case resp of |
|
|
|
(ResponseNotifications ns) -> do |
|
|
|
(ResponseNotifications ns) -> do |
|
|
|
case lastMay ns of |
|
|
|
forM_ ns $ \notif -> do |
|
|
|
Just n -> atomicWriteIORef notifSqnumRef (nextSqnum $ getNotificationSqnum n) |
|
|
|
lastSqnum <- readIORef notifSqnumRef |
|
|
|
Nothing -> return () |
|
|
|
when (getNotificationSqnum notif >= lastSqnum) $ do |
|
|
|
return () |
|
|
|
forM_ callbacks $ \c -> c notif |
|
|
|
|
|
|
|
atomicWriteIORef notifSqnumRef (nextSqnum lastSqnum) |
|
|
|
(ResponseError msg) -> warningM "Broker.Client" $ "ResponseError: " <> T.unpack msg |
|
|
|
(ResponseError msg) -> warningM "Broker.Client" $ "ResponseError: " <> T.unpack msg |
|
|
|
_ -> warningM "Broker.Client" $ "Unknown error when requesting notifications" |
|
|
|
_ -> warningM "Broker.Client" "Unknown error when requesting notifications" |
|
|
|
else do |
|
|
|
else do |
|
|
|
msg <- receiveMulti sock |
|
|
|
msg <- receiveMulti sock |
|
|
|
case msg of |
|
|
|
case msg of |
|
|
|
|