mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-13 05:25:59 +08:00
msg size
This commit is contained in:
@@ -40,7 +40,12 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) {
|
||||
return
|
||||
}
|
||||
log.NewInfo(m.OperationID, "Basic Info Authentication Success", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
||||
|
||||
if m.SendID != conn.userID {
|
||||
if err = conn.Close(); err != nil {
|
||||
log.NewError(m.OperationID, "close ws conn failed", conn.userID, "send id", m.SendID, err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
switch m.ReqIdentifier {
|
||||
case constant.WSGetNewestSeq:
|
||||
log.NewInfo(m.OperationID, "getSeqReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
|
||||
|
||||
@@ -34,6 +34,7 @@ type UserConn struct {
|
||||
platformID int32
|
||||
PushedMaxSeq uint32
|
||||
IsCompress bool
|
||||
userID string
|
||||
}
|
||||
type WServer struct {
|
||||
wsAddr string
|
||||
@@ -82,7 +83,7 @@ func (ws *WServer) wsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Header.Get("compression") == "gzip" {
|
||||
isCompress = true
|
||||
}
|
||||
newConn := &UserConn{conn, new(sync.Mutex), utils.StringToInt32(query["platformID"][0]), 0, isCompress}
|
||||
newConn := &UserConn{conn, new(sync.Mutex), utils.StringToInt32(query["platformID"][0]), 0, isCompress, query["sendID"][0]}
|
||||
userCount++
|
||||
ws.addUserConn(query["sendID"][0], utils.StringToInt(query["platformID"][0]), newConn, query["token"][0], operationID)
|
||||
go ws.readMsg(newConn)
|
||||
@@ -121,6 +122,7 @@ func (ws *WServer) readMsg(conn *UserConn) {
|
||||
log.NewWarn("", "reader close failed")
|
||||
}
|
||||
}
|
||||
log.NewDebug("", "size", utils.ByteSize(uint64(len(msg))))
|
||||
ws.msgParse(conn, msg)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user