feat(login): 重构 login 服务启动方式

- 修改 login 服务端口配置,支持动态分配
- 优化 login 服务启动流程,增加信号处理
- 调整 ServerOption 类型,支持 int 类型端口
- 移除 CommendSvrInfo 相关代码,简化结构
- 更新 main 函数,采用新的服务启动方式
This commit is contained in:
2025-07-06 01:49:19 +08:00
parent 86c38fbc84
commit 2f3ca21165
19 changed files with 301 additions and 45 deletions

View File

@@ -4,6 +4,7 @@ import (
"blazing/common/socket/codec"
"blazing/common/socket/handler"
"github.com/gogf/gf/v2/util/gconv"
"github.com/panjf2000/gnet/pkg/pool/goroutine"
"github.com/panjf2000/gnet/v2"
)
@@ -60,10 +61,10 @@ func WithBufferSize(bufferSize int) Option {
u.bufferSize = bufferSize
}
}
func WithPort(port string) Option {
func WithPort(port int) Option {
return func(s *Server) {
s.network = "tcp"
s.addr = ":" + port
s.addr = ":" + gconv.String(port)
}
}