mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-24 18:36:19 +08:00
Merge branch 'tuoyun' of github.com:OpenIMSDK/Open-IM-Server into tuoyun
This commit is contained in:
commit
60e29cc894
@ -24,6 +24,10 @@ services:
|
|||||||
- ./components/mongodb/data/db:/data/db
|
- ./components/mongodb/data/db:/data/db
|
||||||
- ./components/mongodb/data/logs:/data/logs
|
- ./components/mongodb/data/logs:/data/logs
|
||||||
- ./components/mongodb/data/conf:/etc/mongo
|
- ./components/mongodb/data/conf:/etc/mongo
|
||||||
|
environment:
|
||||||
|
- TZ=Asia/Shanghai
|
||||||
|
# cache
|
||||||
|
- wiredTigerCacheSizeGB=1
|
||||||
# environment:
|
# environment:
|
||||||
# - MONGO_INITDB_ROOT_USERNAME=openIM
|
# - MONGO_INITDB_ROOT_USERNAME=openIM
|
||||||
# - MONGO_INITDB_ROOT_PASSWORD=openIM
|
# - MONGO_INITDB_ROOT_PASSWORD=openIM
|
||||||
|
@ -46,7 +46,7 @@ func init() {
|
|||||||
//err = minioClient.SetBucketPolicy(context.Background(), config.Config.Credential.Minio.Bucket, policy.BucketPolicyReadWrite)
|
//err = minioClient.SetBucketPolicy(context.Background(), config.Config.Credential.Minio.Bucket, policy.BucketPolicyReadWrite)
|
||||||
//if err != nil {
|
//if err != nil {
|
||||||
// log.NewError("", utils.GetSelfFuncName(), "SetBucketPolicy failed please set in ", err.Error())
|
// log.NewError("", utils.GetSelfFuncName(), "SetBucketPolicy failed please set in ", err.Error())
|
||||||
// return
|
// return`z
|
||||||
//}
|
//}
|
||||||
log.NewInfo("", utils.GetSelfFuncName(), "minio create and set policy success")
|
log.NewInfo("", utils.GetSelfFuncName(), "minio create and set policy success")
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,8 @@ var (
|
|||||||
validate *validator.Validate
|
validate *validator.Validate
|
||||||
ws WServer
|
ws WServer
|
||||||
rpcSvr RPCServer
|
rpcSvr RPCServer
|
||||||
count uint64
|
sendMsgCount uint64
|
||||||
|
userCount uint64
|
||||||
)
|
)
|
||||||
|
|
||||||
func Init(rpcPort, wsPort int) {
|
func Init(rpcPort, wsPort int) {
|
||||||
@ -22,7 +23,8 @@ func Init(rpcPort, wsPort int) {
|
|||||||
log.NewPrivateLog(config.Config.ModuleName.LongConnSvrName)
|
log.NewPrivateLog(config.Config.ModuleName.LongConnSvrName)
|
||||||
rwLock = new(sync.RWMutex)
|
rwLock = new(sync.RWMutex)
|
||||||
validate = validator.New()
|
validate = validator.New()
|
||||||
statistics.NewStatistics(&count, config.Config.ModuleName.LongConnSvrName, fmt.Sprintf("%d second recv to msg_gateway count", count), 10)
|
statistics.NewStatistics(&sendMsgCount, config.Config.ModuleName.LongConnSvrName, fmt.Sprintf("%d second recv to msg_gateway sendMsgCount", sendMsgCount), 10)
|
||||||
|
statistics.NewStatistics(&userCount, config.Config.ModuleName.LongConnSvrName, fmt.Sprintf("%d second add user conn", userCount), 10)
|
||||||
ws.onInit(wsPort)
|
ws.onInit(wsPort)
|
||||||
rpcSvr.onInit(rpcPort)
|
rpcSvr.onInit(rpcPort)
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ func (ws *WServer) pullMsgBySeqListResp(conn *UserConn, m *Req, pb *sdk_ws.PullM
|
|||||||
|
|
||||||
}
|
}
|
||||||
func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) {
|
func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) {
|
||||||
count++
|
sendMsgCount++
|
||||||
log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID)
|
log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID)
|
||||||
nReply := new(pbChat.SendMsgResp)
|
nReply := new(pbChat.SendMsgResp)
|
||||||
isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg)
|
isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg)
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db"
|
"Open_IM/pkg/common/db"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/token_verify"
|
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
@ -184,6 +183,7 @@ func (ws *WServer) addUserConn(uid string, platformID int32, conn *UserConn, tok
|
|||||||
count = count + len(v)
|
count = count + len(v)
|
||||||
}
|
}
|
||||||
log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "connection_uid", uid, "connection_platform", constant.PlatformIDToName(platformID), "online_user_num", len(ws.wsUserToConn), "online_conn_num", count)
|
log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "connection_uid", uid, "connection_platform", constant.PlatformIDToName(platformID), "online_user_num", len(ws.wsUserToConn), "online_conn_num", count)
|
||||||
|
userCount = uint64(len(ws.wsUserToConn))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,6 +210,7 @@ func (ws *WServer) delUserConn(conn *UserConn) {
|
|||||||
} else {
|
} else {
|
||||||
log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "disconnection_uid", uid, "disconnection_platform", platform, "online_user_num", len(ws.wsUserToConn))
|
log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "disconnection_uid", uid, "disconnection_platform", platform, "online_user_num", len(ws.wsUserToConn))
|
||||||
}
|
}
|
||||||
|
userCount = uint64(len(ws.wsUserToConn))
|
||||||
delete(ws.wsConnToUser, conn)
|
delete(ws.wsConnToUser, conn)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -256,16 +257,16 @@ func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool {
|
|||||||
status := http.StatusUnauthorized
|
status := http.StatusUnauthorized
|
||||||
query := r.URL.Query()
|
query := r.URL.Query()
|
||||||
if len(query["token"]) != 0 && len(query["sendID"]) != 0 && len(query["platformID"]) != 0 {
|
if len(query["token"]) != 0 && len(query["sendID"]) != 0 && len(query["platformID"]) != 0 {
|
||||||
if ok, err := token_verify.VerifyToken(query["token"][0], query["sendID"][0]); !ok {
|
//if ok, err := token_verify.VerifyToken(query["token"][0], query["sendID"][0]); !ok {
|
||||||
e := err.(*constant.ErrInfo)
|
// e := err.(*constant.ErrInfo)
|
||||||
log.ErrorByKv("Token verify failed", "", "query", query)
|
// log.ErrorByKv("Token verify failed", "", "query", query)
|
||||||
w.Header().Set("Sec-Websocket-Version", "13")
|
// w.Header().Set("Sec-Websocket-Version", "13")
|
||||||
http.Error(w, e.ErrMsg, int(e.ErrCode))
|
// http.Error(w, e.ErrMsg, int(e.ErrCode))
|
||||||
return false
|
// return false
|
||||||
} else {
|
//} else {
|
||||||
log.InfoByKv("Connection Authentication Success", "", "token", query["token"][0], "userID", query["sendID"][0])
|
log.InfoByKv("Connection Authentication Success", "", "token", query["token"][0], "userID", query["sendID"][0])
|
||||||
return true
|
return true
|
||||||
}
|
//}
|
||||||
} else {
|
} else {
|
||||||
log.ErrorByKv("Args err", "", "query", query)
|
log.ErrorByKv("Args err", "", "query", query)
|
||||||
w.Header().Set("Sec-Websocket-Version", "13")
|
w.Header().Set("Sec-Websocket-Version", "13")
|
||||||
|
@ -21,8 +21,7 @@ func (s *Statistics) output() {
|
|||||||
select {
|
select {
|
||||||
case <-t.C:
|
case <-t.C:
|
||||||
}
|
}
|
||||||
log.NewWarn(s.ModuleName, s.PrintArgs, *s.Count-sum)
|
log.NewWarn("", " system stat ", s.ModuleName, s.PrintArgs, *s.Count-sum, "total:", *s.Count)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
source ./style_info.cfg
|
source ./style_info.cfg
|
||||||
source ./path_info.cfg
|
source ./path_info.cfg
|
||||||
source ./function.sh
|
source ./function.sh
|
||||||
|
ulimit -n 200000
|
||||||
|
|
||||||
list1=$(cat $config_path | grep openImOnlineRelayPort | awk -F '[:]' '{print $NF}')
|
list1=$(cat $config_path | grep openImOnlineRelayPort | awk -F '[:]' '{print $NF}')
|
||||||
list2=$(cat $config_path | grep openImWsPort | awk -F '[:]' '{print $NF}')
|
list2=$(cat $config_path | grep openImWsPort | awk -F '[:]' '{print $NF}')
|
||||||
list_to_string $list1
|
list_to_string $list1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user