refactor(socket): 重构 socket 模块
- 移除 common/data/socket 目录下的大部分文件 - 新增 service 目录,将 Player 和 Conn 结构体移至该目录 - 更新 LogicClient 中的方法签名,使用 service 包的类型 - 重构 Controller 中的方法,适应新的 service 包结构
This commit is contained in:
@@ -3,10 +3,11 @@ package main
|
||||
import (
|
||||
"blazing/common/rpc"
|
||||
"blazing/common/socket"
|
||||
"blazing/common/socket/handler"
|
||||
|
||||
"blazing/cool"
|
||||
"blazing/logic/controller"
|
||||
"blazing/modules/blazing/service"
|
||||
"blazing/logic/service"
|
||||
blservice "blazing/modules/blazing/service"
|
||||
|
||||
"fmt"
|
||||
"log"
|
||||
@@ -62,7 +63,7 @@ func isPortAvailable(port int) bool {
|
||||
// 如果id是0,那就是login server
|
||||
func Start(serverid uint16) {
|
||||
//ants.NewPool(100)
|
||||
head := handler.NewTomeeHandler()
|
||||
head := service.NewTomeeHandler()
|
||||
head.Callback = controller.Recv
|
||||
if serverid != 0 { //logic服务器
|
||||
// 确定端口
|
||||
@@ -77,7 +78,7 @@ func Start(serverid uint16) {
|
||||
controller.Maincontroller.RPCClient = *t //将RPC赋值Start
|
||||
controller.Maincontroller.Port = uint16(port) //赋值服务器ID
|
||||
|
||||
service.NewLoginServiceService().SetServerID(serverid, gconv.Uint16(port), t)
|
||||
blservice.NewLoginServiceService().SetServerID(serverid, gconv.Uint16(port), t)
|
||||
socket.
|
||||
NewServer(
|
||||
socket.WithCORS(),
|
||||
|
||||
Reference in New Issue
Block a user