refactor(tcp): 优化TCP服务器连接池变量命名

- 将sqlitePool错误信息中的pool改为connPool以保持一致性
- 将ConnectionPool实例变量名从pool重命名为connPool
- 更新TCPServer结构体中Connection字段的赋值引用
main
black1552 2026-03-02 10:14:06 +08:00
parent 86116618e4
commit d958f4c059
2 changed files with 4 additions and 4 deletions

View File

@ -327,7 +327,7 @@
<entry key="file://$PROJECT_DIR$/tcp/tcp.go"> <entry key="file://$PROJECT_DIR$/tcp/tcp.go">
<value> <value>
<ScannedPath> <ScannedPath>
<option name="lastModified" value="1772413469943" /> <option name="lastModified" value="1772416836034" />
<option name="schema"> <option name="schema">
<list> <list>
<option value="TCPServer" /> <option value="TCPServer" />

View File

@ -48,10 +48,10 @@ func NewTCPServer(address string, config *TcpPoolConfig) (*TCPServer, error) {
// 初始化SQLite连接池 // 初始化SQLite连接池
sqlitePool, err := pool.NewSQLitePool() sqlitePool, err := pool.NewSQLitePool()
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to create sqlite pool: %w", err) return nil, fmt.Errorf("failed to create sqlite connPool: %w", err)
} }
pool := &ConnectionPool{ connPool := &ConnectionPool{
connections: make(map[string]*TcpConnection), connections: make(map[string]*TcpConnection),
sqlitePool: sqlitePool, sqlitePool: sqlitePool,
config: config, config: config,
@ -61,7 +61,7 @@ func NewTCPServer(address string, config *TcpPoolConfig) (*TCPServer, error) {
server := &TCPServer{ server := &TCPServer{
Address: address, Address: address,
Config: config, Config: config,
Connection: pool, Connection: connPool,
Logger: logger, Logger: logger,
ctx: ctx, ctx: ctx,
cancel: cancel, cancel: cancel,