Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop
This commit is contained in:
commit
d1d1b2ced0
@ -11,7 +11,7 @@ import (
|
|||||||
"fusenapi/utils/file"
|
"fusenapi/utils/file"
|
||||||
"fusenapi/utils/hash"
|
"fusenapi/utils/hash"
|
||||||
"image"
|
"image"
|
||||||
"image/jpeg"
|
"image/png"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ func (l *LogoResizeLogic) LogoResize(req *types.LogoResizeReq, userinfo *auth.Us
|
|||||||
}
|
}
|
||||||
|
|
||||||
emptyBuff := bytes.NewBuffer(nil) //开辟一个新的空buff
|
emptyBuff := bytes.NewBuffer(nil) //开辟一个新的空buff
|
||||||
jpeg.Encode(emptyBuff, src, nil) //img写入到buff
|
png.Encode(emptyBuff, src) //img写入到buff
|
||||||
|
|
||||||
var hashKeyDataMap = make(map[string]interface{})
|
var hashKeyDataMap = make(map[string]interface{})
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ var (
|
|||||||
//用户标识的连接(白板用户不存)
|
//用户标识的连接(白板用户不存)
|
||||||
mapUserConnPool = make(map[string]map[string]struct{}) //key是user_id +"_"+guest_id (val是个普通map,存储这个用户的所有连接标识)
|
mapUserConnPool = make(map[string]map[string]struct{}) //key是user_id +"_"+guest_id (val是个普通map,存储这个用户的所有连接标识)
|
||||||
//用户标识的连接增删操作队列
|
//用户标识的连接增删操作队列
|
||||||
mapUserConnPoolCtlChan = make(chan userConnPoolChanItem, 2000)
|
mapUserConnPoolCtlChan = make(chan userConnPoolCtlChanItem, 2000)
|
||||||
//每个websocket连接入口缓冲队列长度
|
//每个websocket连接入口缓冲队列长度
|
||||||
websocketInChanLen = 1000
|
websocketInChanLen = 1000
|
||||||
//每个websocket连接出口缓冲队列长度
|
//每个websocket连接出口缓冲队列长度
|
||||||
@ -89,7 +89,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// 用户标识的连接增删操作队列传输的值的结构
|
// 用户标识的连接增删操作队列传输的值的结构
|
||||||
type userConnPoolChanItem struct {
|
type userConnPoolCtlChanItem struct {
|
||||||
userId int64 //必须(两个用户id任意一个不为0)
|
userId int64 //必须(两个用户id任意一个不为0)
|
||||||
guestId int64 //必须(两个用户id任意一个不为0)
|
guestId int64 //必须(两个用户id任意一个不为0)
|
||||||
uniqueId string //主连接池唯一标识(添加/删除时候必须)
|
uniqueId string //主连接池唯一标识(添加/删除时候必须)
|
||||||
@ -221,7 +221,7 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
|
|||||||
|
|
||||||
// 添加用户索引池ws连接
|
// 添加用户索引池ws连接
|
||||||
func createUserConnPoolElement(userId, guestId int64, uniqueId string) {
|
func createUserConnPoolElement(userId, guestId int64, uniqueId string) {
|
||||||
data := userConnPoolChanItem{
|
data := userConnPoolCtlChanItem{
|
||||||
userId: userId,
|
userId: userId,
|
||||||
guestId: guestId,
|
guestId: guestId,
|
||||||
uniqueId: uniqueId,
|
uniqueId: uniqueId,
|
||||||
@ -239,7 +239,7 @@ func createUserConnPoolElement(userId, guestId int64, uniqueId string) {
|
|||||||
|
|
||||||
// 从用户索引池删除ws连接
|
// 从用户索引池删除ws连接
|
||||||
func deleteUserConnPoolElement(userId, guestId int64, uniqueId string) {
|
func deleteUserConnPoolElement(userId, guestId int64, uniqueId string) {
|
||||||
data := userConnPoolChanItem{
|
data := userConnPoolCtlChanItem{
|
||||||
userId: userId,
|
userId: userId,
|
||||||
guestId: guestId,
|
guestId: guestId,
|
||||||
uniqueId: uniqueId,
|
uniqueId: uniqueId,
|
||||||
@ -255,9 +255,9 @@ func deleteUserConnPoolElement(userId, guestId int64, uniqueId string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据用户索引发现链接并发送消息到出口队列
|
// 根据用户索引发现链接并发送(广播)消息到出口队列
|
||||||
func sendToOutChanByUserIndex(userId, guestId int64, message []byte) {
|
func sendToOutChanByUserIndex(userId, guestId int64, message []byte) {
|
||||||
data := userConnPoolChanItem{
|
data := userConnPoolCtlChanItem{
|
||||||
userId: userId,
|
userId: userId,
|
||||||
guestId: guestId,
|
guestId: guestId,
|
||||||
uniqueId: "",
|
uniqueId: "",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user