refactor(tcp): 优化TCP服务器连接池变量命名
- 将sqlitePool错误信息中的pool改为connPool以保持一致性 - 将ConnectionPool实例变量名从pool重命名为connPool - 更新TCPServer结构体中Connection字段的赋值引用main
parent
86116618e4
commit
d958f4c059
|
|
@ -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" />
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue