Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: inactive connections/members #4009

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft

Conversation

spaced4ndy
Copy link
Contributor

No description provided.

Comment on lines +4340 to +4344
processConnQCONT connEntity conn
lastSharedMsgId <- withStore' $ \db -> getLastItemSharedMsgId db m
forM_ lastSharedMsgId $ \lastMsgId -> do
let conn' = conn {inactive = False} :: Connection
void $ sendDirectMemberMessage conn' (XGrpMsgSkipped lastMsgId) groupId
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

processConnQCONT could return updated connection conn'

Comment on lines +4589 to +4593
processConnQCONT :: ConnectionEntity -> Connection -> CM ()
processConnQCONT connEntity conn =
when (connInactive conn) $ do
withStore' $ \db -> setConnectionInactive db user conn False
toView $ CRConnectionInactive connEntity False
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO could also reset on MSG and RCVD

@@ -4331,11 +4336,17 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage =
OK ->
-- [async agent commands] continuation on receiving OK
when (corrId /= "") $ withCompletedCommand conn agentMsg $ \_cmdData -> pure ()
QCONT -> do
processConnQCONT connEntity conn
lastSharedMsgId <- withStore' $ \db -> getLastItemSharedMsgId db m
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • for super peer it may be better to instead search via msg_deliveries table, to account for forwarded group messages (see forwardMsg_)
    • may have to additionally store original shared msg id (currently shared_msg_id is for the forwarded message itself)
  • or populate group_snd_item_statuses?
  • store additional data?

SELECT chat_item_id
FROM group_snd_item_statuses
WHERE group_member_id = ?
AND (group_snd_item_status LIKE 'snd_sent%' OR group_snd_item_status LIKE 'snd_rcvd%')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could store "tags" to avoid LIKE

Comment on lines +5945 to +5948
xGrpMsgSkipped :: GroupInfo -> GroupMember -> SharedMsgId -> RcvMessage -> UTCTime -> CM ()
xGrpMsgSkipped _gInfo _m _sharedMsgId _msg _brokerTs = do
-- TODO can request delivery starting with _sharedMsgId here
pure ()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

originally had a new type of group event chat item created here, but removed it as there's already integrity error item created so it seems unnecessary. Maybe should add it back, with it saying "member continued delivery for you"

@@ -6470,7 +6500,7 @@ memberSendAction :: ChatMsgEvent e -> [GroupMember] -> GroupMember -> Maybe Memb
memberSendAction chatMsgEvent members m@GroupMember {invitedByGroupMemberId} = case memberConn m of
Nothing -> pendingOrForwarded
Just conn@Connection {connStatus}
| connDisabled conn || connStatus == ConnDeleted -> Nothing
| connDisabled conn || connInactive conn || connStatus == ConnDeleted -> Nothing
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may apply to contact connections as well, decided against it and only track info for them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant