feat: strengthen risk controls and review workflows
This commit is contained in:
@@ -1136,6 +1136,28 @@ func onlineAccounts() []string {
|
||||
return accounts
|
||||
}
|
||||
|
||||
// DisconnectAccount closes every live downstream CMPP session for an
|
||||
// application account. The normal connection-close callback removes registry
|
||||
// and presence state and reports the disconnect to the API.
|
||||
func DisconnectAccount(account string) int {
|
||||
account = strings.TrimSpace(account)
|
||||
if account == "" {
|
||||
return 0
|
||||
}
|
||||
downstreamRegistry.RLock()
|
||||
sessions := make([]*downstreamSession, 0)
|
||||
for _, session := range downstreamRegistry.byConn {
|
||||
if session != nil && session.account == account && session.conn != nil {
|
||||
sessions = append(sessions, session)
|
||||
}
|
||||
}
|
||||
downstreamRegistry.RUnlock()
|
||||
for _, session := range sessions {
|
||||
session.conn.Close()
|
||||
}
|
||||
return len(sessions)
|
||||
}
|
||||
|
||||
func PushReceipt(event DownstreamReceipt) (bool, error) {
|
||||
result, err := PushReceiptWithResult(event)
|
||||
return result.Sent, err
|
||||
|
||||
Reference in New Issue
Block a user