Fix connection leak and panic at close operation #171

Merged
alexvanin merged 3 commits from alexvanin/frostfs-sdk-go:fix/pool-panic-leak into master 2024-09-04 19:51:15 +00:00
Showing only changes of commit 8a04638749 - Show all commits

View file

@ -86,6 +86,8 @@ type client interface {
type clientStatus interface { type clientStatus interface {
// isHealthy checks if the connection can handle requests. // isHealthy checks if the connection can handle requests.
isHealthy() bool isHealthy() bool
// isDialed checks if the connection was created.
isDialed() bool
// setUnhealthy marks client as unhealthy. // setUnhealthy marks client as unhealthy.
setUnhealthy() setUnhealthy()
// address return address of endpoint. // address return address of endpoint.
@ -2809,10 +2811,12 @@ func (p *Pool) Close() {
// close all clients // close all clients
for _, pools := range p.innerPools { for _, pools := range p.innerPools {
for _, cli := range pools.clients { for _, cli := range pools.clients {
if cli.isDialed() {
_ = cli.close() _ = cli.close()
} }
} }
} }
}
// SyncContainerWithNetwork applies network configuration received via // SyncContainerWithNetwork applies network configuration received via
// the Pool to the container. Changes the container if it does not satisfy // the Pool to the container. Changes the container if it does not satisfy