mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
journal: only destroy the connection if it is set
Prevent re-use of a destroyed connection by setting it to `nil`. This way it is also safe to call `Destroy()` multiple times without causing a panic. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
e154eae732
commit
6df173dbf3
@ -143,7 +143,10 @@ func (vgc *VolumeGroupJournalConfig) Connect(
|
||||
|
||||
// Destroy frees any resources and invalidates the journal connection.
|
||||
func (vgjc *volumeGroupJournalConnection) Destroy() {
|
||||
vgjc.connection.Destroy()
|
||||
if vgjc.connection != nil {
|
||||
vgjc.connection.Destroy()
|
||||
vgjc.connection = nil
|
||||
}
|
||||
}
|
||||
|
||||
// VolumeGroupData contains the GroupUUID and VolumeGroupAttributes for a
|
||||
|
Loading…
Reference in New Issue
Block a user