fix potentially missing client or stream for a quic store

This commit is contained in:
Mark Beamer Jr 2020-03-22 00:38:46 -04:00 committed by Niko Storni
parent e98794e125
commit de1fb63a1c

View file

@ -29,11 +29,15 @@ func NewStore(opts StoreOpts) *Store {
// CloseStore closes the client that gets initialized when the store is initialized
func (p *Store) CloseStore() error {
if p.client != nil && p.client.stream != nil {
err := p.client.stream.Close()
if err != nil {
return errors.Err(err)
}
return p.client.Close()
}
return nil
}
// Has asks the peer if they have a hash