close closes an existing connection to our peer Seesaw node.
()
| 389 | |
| 390 | // close closes an existing connection to our peer Seesaw node. |
| 391 | func (sc *syncClient) close() error { |
| 392 | sc.lock.Lock() |
| 393 | defer sc.lock.Unlock() |
| 394 | if sc.client == nil { |
| 395 | return nil |
| 396 | } |
| 397 | sc.refs-- |
| 398 | if sc.refs > 0 { |
| 399 | return nil |
| 400 | } |
| 401 | if err := sc.client.Close(); err != nil { |
| 402 | sc.client = nil |
| 403 | return fmt.Errorf("client close failed: %v", err) |
| 404 | } |
| 405 | sc.client = nil |
| 406 | return nil |
| 407 | } |
| 408 | |
| 409 | // failover requests that the peer node initiate a failover. |
| 410 | func (sc *syncClient) failover() error { |