fix potentially missing client or stream for a quic store
This commit is contained in:
parent
e98794e125
commit
de1fb63a1c
1 changed files with 8 additions and 4 deletions
|
@ -29,11 +29,15 @@ func NewStore(opts StoreOpts) *Store {
|
||||||
|
|
||||||
// CloseStore closes the client that gets initialized when the store is initialized
|
// CloseStore closes the client that gets initialized when the store is initialized
|
||||||
func (p *Store) CloseStore() error {
|
func (p *Store) CloseStore() error {
|
||||||
err := p.client.stream.Close()
|
if p.client != nil && p.client.stream != nil {
|
||||||
if err != nil {
|
err := p.client.stream.Close()
|
||||||
return errors.Err(err)
|
if err != nil {
|
||||||
|
return errors.Err(err)
|
||||||
|
}
|
||||||
|
return p.client.Close()
|
||||||
}
|
}
|
||||||
return p.client.Close()
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has asks the peer if they have a hash
|
// Has asks the peer if they have a hash
|
||||||
|
|
Loading…
Reference in a new issue