diff --git a/client.go b/client.go index 56890ef..7eb996a 100644 --- a/client.go +++ b/client.go @@ -406,7 +406,7 @@ func (c *TunaSessionClient) listenNet(i int) { for { netConn, err := c.listeners[i].Accept() if err != nil { - if c.IsClosed() { + if c.isClosed { return } log.Printf("Accept connection error: %v", err) @@ -877,7 +877,7 @@ func (c *TunaSessionClient) removeClosedSessions() { for { time.Sleep(time.Second) - if c.IsClosed() { + if c.isClosed { return } @@ -1011,7 +1011,7 @@ func (c *TunaSessionClient) dialTcpConn(ctx context.Context, remoteAddr string, } func (c *TunaSessionClient) reconnect(remoteAddr string, sessionID []byte, i int, pubAddrs *PubAddrs, config *nkn.DialConfig) (conn *Conn, err error) { - if c.IsClosed() { + if c.isClosed { return nil, ErrClosed } sessKey := sessionKey(remoteAddr, sessionID) diff --git a/udp.go b/udp.go index 1787c02..324bd3d 100644 --- a/udp.go +++ b/udp.go @@ -81,7 +81,7 @@ func (c *TunaSessionClient) DialUDPWithConfig(remoteAddr string, config *nkn.Dia for { udpSess.handleTcpMsg(udpSess.tcpConn, sessionKey(remoteAddr, sessionID)) - if c.IsClosed() || udpSess.udpConn.IsClosed() { + if c.isClosed || udpSess.udpConn.IsClosed() { break } if c.config.ReconnectRetries == 0 { diff --git a/udpsession.go b/udpsession.go index 8616ec6..396c683 100644 --- a/udpsession.go +++ b/udpsession.go @@ -79,7 +79,7 @@ func newUdpSession(ts *TunaSessionClient, isListener bool) *UdpSession { } func (us *UdpSession) DialUpSession(listenerNknAddr string, sessionID []byte, config *nkn.DialConfig) (err error) { - if us.ts.IsClosed() { + if us.ts.isClosed { return ErrClosed } @@ -203,7 +203,7 @@ func (us *UdpSession) GetUDPConn() *tuna.EncryptUDPConn { } func (us *UdpSession) GetEstablishedUDPConn() (*tuna.EncryptUDPConn, error) { - if us.ts.IsClosed() { + if us.ts.isClosed { return nil, ErrClosed } conn := us.GetUDPConn() @@ -315,7 +315,7 @@ func (us *UdpSession) Write(b []byte) (int, error) { } func (us *UdpSession) SetDeadline(t time.Time) error { - if us.ts.IsClosed() { + if us.ts.isClosed { return ErrClosed }