mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-23 18:00:32 +08:00
pc terminal can login at same time
This commit is contained in:
parent
9a82dd356c
commit
ed5b215bbb
@ -147,6 +147,11 @@ func (ws *WServer) MultiTerminalLoginCheckerWithLock(uid string, platformID int,
|
|||||||
defer rwLock.Unlock()
|
defer rwLock.Unlock()
|
||||||
log.NewInfo(operationID, utils.GetSelfFuncName(), " rpc args: ", uid, platformID, token)
|
log.NewInfo(operationID, utils.GetSelfFuncName(), " rpc args: ", uid, platformID, token)
|
||||||
switch config.Config.MultiLoginPolicy {
|
switch config.Config.MultiLoginPolicy {
|
||||||
|
case constant.PCAndOther:
|
||||||
|
if constant.PlatformNameToClass(constant.PlatformIDToName(platformID)) == constant.TerminalPC {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
case constant.AllLoginButSameTermKick:
|
case constant.AllLoginButSameTermKick:
|
||||||
if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn]
|
if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn]
|
||||||
if oldConn, ok := oldConnMap[platformID]; ok {
|
if oldConn, ok := oldConnMap[platformID]; ok {
|
||||||
@ -197,6 +202,11 @@ func (ws *WServer) MultiTerminalLoginCheckerWithLock(uid string, platformID int,
|
|||||||
|
|
||||||
func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int, newConn *UserConn, token string, operationID string) {
|
func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int, newConn *UserConn, token string, operationID string) {
|
||||||
switch config.Config.MultiLoginPolicy {
|
switch config.Config.MultiLoginPolicy {
|
||||||
|
case constant.PCAndOther:
|
||||||
|
if constant.PlatformNameToClass(constant.PlatformIDToName(platformID)) == constant.TerminalPC {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
case constant.AllLoginButSameTermKick:
|
case constant.AllLoginButSameTermKick:
|
||||||
if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn]
|
if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn]
|
||||||
if oldConn, ok := oldConnMap[platformID]; ok {
|
if oldConn, ok := oldConnMap[platformID]; ok {
|
||||||
|
@ -140,6 +140,8 @@ const (
|
|||||||
WebAndOther = 3
|
WebAndOther = 3
|
||||||
//The PC side is mutually exclusive, and the mobile side is mutually exclusive, but the web side can be online at the same time
|
//The PC side is mutually exclusive, and the mobile side is mutually exclusive, but the web side can be online at the same time
|
||||||
PcMobileAndWeb = 4
|
PcMobileAndWeb = 4
|
||||||
|
//The PC terminal can be online at the same time,but other terminal only one of the endpoints can login
|
||||||
|
PCAndOther = 5
|
||||||
|
|
||||||
OnlineStatus = "online"
|
OnlineStatus = "online"
|
||||||
OfflineStatus = "offline"
|
OfflineStatus = "offline"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user