File tree 2 files changed +13
-0
lines changed
internal/connectionmanager
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -88,3 +88,8 @@ func (conn *Conn) Close() error {
88
88
conn .closeConnectionToManagerCh <- struct {}{}
89
89
return conn .connectionManager .Close ()
90
90
}
91
+
92
+ // IsClosed returns whether the connection is closed or not
93
+ func (conn * Conn ) IsClosed () bool {
94
+ return conn .connectionManager .IsClosed ()
95
+ }
Original file line number Diff line number Diff line change @@ -171,3 +171,11 @@ func (connManager *ConnectionManager) reconnect() error {
171
171
connManager .connection = conn
172
172
return nil
173
173
}
174
+
175
+ // IsClosed checks if the connection is closed
176
+ func (connManager * ConnectionManager ) IsClosed () bool {
177
+ connManager .connectionMu .Lock ()
178
+ defer connManager .connectionMu .Unlock ()
179
+
180
+ return connManager .connection .IsClosed ()
181
+ }
You can’t perform that action at this time.
0 commit comments