Commit 28e1f910 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ab8515ce
......@@ -406,6 +406,11 @@ func openByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (_ zodb
net = xnet.NetPlain("unix")
addr = u.Path
}
defer func() {
if net != nil {
net.Close()
}
}()
storageID := "1"
......@@ -422,6 +427,8 @@ func openByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (_ zodb
if err != nil {
return nil, zodb.InvalidTid, err
}
zlink.closeq = append(zlink.closeq, net)
net = nil
defer func() {
if err != nil {
......
......@@ -80,6 +80,8 @@ type zLink struct {
ver string // protocol version in use (without "Z" or "M" prefix)
enc encoding // protocol encoding in use ('Z' or 'M')
closeq []io.Closer // to be also closed on Close
}
// zLinkError is returned by zLink operations.
......@@ -128,6 +130,12 @@ func (zl *zLink) shutdown(err error) {
if err == nil {
err = err2
}
for _, c := range(zl.closeq) {
err2 := c.Close()
if err == nil {
err = err2
}
}
if err != nil {
log.Printf("%s", err)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment