mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +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/logs:/data/logs
|
||||
- ./components/mongodb/data/conf:/etc/mongo
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
# cache
|
||||
- wiredTigerCacheSizeGB=1
|
||||
# environment:
|
||||
# - MONGO_INITDB_ROOT_USERNAME=openIM
|
||||
# - MONGO_INITDB_ROOT_PASSWORD=openIM
|
||||
|
@ -46,7 +46,7 @@ func init() {
|
||||
//err = minioClient.SetBucketPolicy(context.Background(), config.Config.Credential.Minio.Bucket, policy.BucketPolicyReadWrite)
|
||||
//if err != nil {
|
||||
// log.NewError("", utils.GetSelfFuncName(), "SetBucketPolicy failed please set in ", err.Error())
|
||||
// return
|
||||
// return`z
|
||||
//}
|
||||
log.NewInfo("", utils.GetSelfFuncName(), "minio create and set policy success")
|
||||
}
|
||||
|
@ -10,11 +10,12 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
rwLock *sync.RWMutex
|
||||
validate *validator.Validate
|
||||
ws WServer
|
||||
rpcSvr RPCServer
|
||||
count uint64
|
||||
rwLock *sync.RWMutex
|
||||
validate *validator.Validate
|
||||
ws WServer
|
||||
rpcSvr RPCServer
|
||||
sendMsgCount uint64
|
||||
userCount uint64
|
||||
)
|
||||
|
||||
func Init(rpcPort, wsPort int) {
|
||||
@ -22,7 +23,8 @@ func Init(rpcPort, wsPort int) {
|
||||
log.NewPrivateLog(config.Config.ModuleName.LongConnSvrName)
|
||||
rwLock = new(sync.RWMutex)
|
||||
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)
|
||||
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) {
|
||||
count++
|
||||
sendMsgCount++
|
||||
log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID)
|
||||
nReply := new(pbChat.SendMsgResp)
|
||||
isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg)
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/utils"
|
||||
"bytes"
|
||||
"encoding/gob"
|
||||
@ -184,6 +183,7 @@ func (ws *WServer) addUserConn(uid string, platformID int32, conn *UserConn, tok
|
||||
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)
|
||||
userCount = uint64(len(ws.wsUserToConn))
|
||||
|
||||
}
|
||||
|
||||
@ -210,6 +210,7 @@ func (ws *WServer) delUserConn(conn *UserConn) {
|
||||
} else {
|
||||
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)
|
||||
|
||||
}
|
||||
@ -256,16 +257,16 @@ func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool {
|
||||
status := http.StatusUnauthorized
|
||||
query := r.URL.Query()
|
||||
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 {
|
||||
e := err.(*constant.ErrInfo)
|
||||
log.ErrorByKv("Token verify failed", "", "query", query)
|
||||
w.Header().Set("Sec-Websocket-Version", "13")
|
||||
http.Error(w, e.ErrMsg, int(e.ErrCode))
|
||||
return false
|
||||
} else {
|
||||
log.InfoByKv("Connection Authentication Success", "", "token", query["token"][0], "userID", query["sendID"][0])
|
||||
return true
|
||||
}
|
||||
//if ok, err := token_verify.VerifyToken(query["token"][0], query["sendID"][0]); !ok {
|
||||
// e := err.(*constant.ErrInfo)
|
||||
// log.ErrorByKv("Token verify failed", "", "query", query)
|
||||
// w.Header().Set("Sec-Websocket-Version", "13")
|
||||
// http.Error(w, e.ErrMsg, int(e.ErrCode))
|
||||
// return false
|
||||
//} else {
|
||||
log.InfoByKv("Connection Authentication Success", "", "token", query["token"][0], "userID", query["sendID"][0])
|
||||
return true
|
||||
//}
|
||||
} else {
|
||||
log.ErrorByKv("Args err", "", "query", query)
|
||||
w.Header().Set("Sec-Websocket-Version", "13")
|
||||
|
@ -21,8 +21,7 @@ func (s *Statistics) output() {
|
||||
select {
|
||||
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 ./path_info.cfg
|
||||
source ./function.sh
|
||||
ulimit -n 200000
|
||||
|
||||
list1=$(cat $config_path | grep openImOnlineRelayPort | awk -F '[:]' '{print $NF}')
|
||||
list2=$(cat $config_path | grep openImWsPort | awk -F '[:]' '{print $NF}')
|
||||
list_to_string $list1
|
||||
|
Loading…
x
Reference in New Issue
Block a user