id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c177000
poolID int64) (int64, *api.StorageVolume, error) { return c.StoragePoolVolumeGetType(project, volumeName, volumeType, poolID, c.nodeID) }
c177001
} err = StorageVolumeConfigAdd(tx.tx, volumeID, volumeConfig) if err != nil { return err } return StorageVolumeDescriptionUpdate(tx.tx, volumeID, volumeDescription) }) if err != nil { return err } return nil }) return err }
c177002
err := storagePoolVolumeReplicateIfCeph(tx.tx, volumeID, project, volumeName, volumeType, poolID, func(volumeID int64) error { _, err := tx.tx.Exec("DELETE FROM storage_volumes WHERE id=?", volumeID) return err }) return err }) return err }
c177003
:= storagePoolVolumeReplicateIfCeph(tx.tx, volumeID, project, oldVolumeName, volumeType, poolID, func(volumeID int64) error { _, err := tx.tx.Exec("UPDATE storage_volumes SET name=? WHERE id=? AND type=?", newVolumeName, volumeID, volumeType) return err }) return err }) return err }
c177004
storageVolumeIDsGet(tx, project, volumeName, volumeType, poolID) if err != nil { return err } } for _, volumeID := range volumeIDs { err := f(volumeID) if err != nil { return err } } return nil }
c177005
if err != nil { return err } volumeID, err := result.LastInsertId() if err != nil { return err } if int64(nodeID) == c.nodeID { // Return the ID of the volume created on this node. thisVolumeID = volumeID } err = StorageVolumeConfigAdd(tx.tx, volumeID, volumeConfig) if err != nil { tx.tx.Rollback() return err } } return nil }) if err != nil { thisVolumeID = -1 } return thisVolumeID, err }
c177006
volumeName, volumeType} outargs := []interface{}{&volumeID} err := dbQueryRowScan(c.db, query, inargs, outargs) if err != nil { if err == sql.ErrNoRows { return -1, ErrNoSuchObject } return -1, err } return volumeID, nil }
c177007
poolID int64) (int64, error) { return c.StoragePoolVolumeGetTypeID("default", volumeName, volumeType, poolID, c.nodeID) }
c177008
case StoragePoolVolumeTypeCustom: return StoragePoolVolumeTypeNameCustom, nil } return "", fmt.Errorf("invalid storage volume type") }
c177009
return err } id64, err := result.LastInsertId() if err != nil { return fmt.Errorf("Error inserting device %s into database", k) } id := int(id64) for ck, cv := range v { // The type is stored as int in the parent entry if ck == "type" || cv == "" { continue } _, err = stmt2.Exec(id, ck, cv) if err != nil { return err } } } return nil }
c177010
JOIN projects ON projects.id=containers.project_id WHERE projects.name=? AND containers.name=?` } var id, dtype int var name, stype string inargs := []interface{}{project, qName} outfmt := []interface{}{id, name, dtype} results, err := queryScan(c.db, q, inargs, outfmt) if err != nil { return nil, err } devices := types.Devices{} for _, r := range results { id = r[0].(int) name = r[1].(string) stype, err = dbDeviceTypeToString(r[2].(int)) if err != nil { return nil, err } newdev, err := dbDeviceConfig(c.db, id, isprofile) if err != nil { return nil, err } newdev["type"] = stype devices[name] = newdev } return devices, nil }
c177011
err } response := []string{} for _, r := range result { response = append(response, r[0].(string)) } return response, nil }
c177012
VALUES (?, strftime("%s"));` _, err := n.db.Exec(stmt, patch) return err }
c177013
:= lex.Capital(entity) if pkg != "db" { typ = pkg + "." + typ } return typ }
c177014
fmt.Sprintf("%sPost", lex.Capital(lex.Plural(entity))) }
c177015
name += "By" name += strings.Join(filters, "And") } return name }
c177016
fields { f += fmt.Sprintf("&%s[i].%s,\n", slice, field.Name) } f += " }\n" f += "}" return f }
c177017
} for key, value := range config2 { if shared.StringInSlice(key, exclude) { continue } if config1[key] != value { present := false for i := range delta { if delta[i] == key { present = true } break } if !present { delta = append(delta, key) } } } sort.Strings(delta) if len(delta) > 0 { return fmt.Errorf("different values for keys: %s", strings.Join(delta, ", ")) } return nil }
c177018
:= map[string]string{} for key, value := range config { copy[key] = value } return copy }
c177019
err != nil { errs[i] = errors.Wrapf(err, "failed to connect to peer %s", address) return } err = hook(client) if err != nil { errs[i] = errors.Wrapf(err, "failed to notify peer %s", address) } }(i, address) } wg.Wait() // TODO: aggregate all errors? for i, err := range errs { if err != nil { // FIXME: unfortunately the LXD client currently does not // provide a way to differentiate between errors if isClientConnectionError(err) && policy == NotifyAlive { logger.Warnf("Could not notify node %s", peers[i]) continue } return err } } return nil } return notifier, nil }
c177020
eventsUpdateListeners(endpoints, cluster, listeners, f) ch <- struct{}{} }() select { case <-ch: case <-ctx.Done(): } } schedule := task.Every(time.Second) return update, schedule }
c177021
special wildcard in order to get notified // about all events across all projects. client = client.UseProject("*") return client.GetEvents() }
c177022
err != nil { return err } return nil }
c177023
profile += fmt.Sprintf(" change_profile -> \":%s://*\",\n", AANamespace(c)) } else { profile += "\n ### Feature: apparmor stacking (not present)\n" profile += " deny /sys/k*{,/**} wklx,\n" } if c.IsNesting() { // Apply nesting bits profile += "\n ### Configuration: nesting\n" profile += strings.TrimLeft(AA_PROFILE_NESTING, "\n") if !state.OS.AppArmorStacking || state.OS.AppArmorStacked { profile += fmt.Sprintf(" change_profile -> \"%s\",\n", AAProfileFull(c)) } } if !c.IsPrivileged() || state.OS.RunningInUserNS { // Apply unprivileged bits profile += "\n ### Configuration: unprivileged containers\n" profile += strings.TrimLeft(AA_PROFILE_UNPRIVILEGED, "\n") } // Append raw.apparmor rawApparmor, ok := c.ExpandedConfig()["raw.apparmor"] if ok { profile += "\n ### Configuration: raw.apparmor\n" for _, line := range strings.Split(strings.Trim(rawApparmor, "\n"), "\n") { profile += fmt.Sprintf(" %s\n", line) } } return fmt.Sprintf(`#include <tunables/global> profile "%s" flags=(attach_disconnected,mediate_deleted) { %s } `, AAProfileFull(c), strings.Trim(profile, "\n")) }
c177024
updated := getAAProfileContent(c) if string(content) != string(updated) { if err := os.MkdirAll(path.Join(aaPath, "cache"), 0700); err != nil { return err } if err := os.MkdirAll(path.Join(aaPath, "profiles"), 0700); err != nil { return err } if err := ioutil.WriteFile(profile, []byte(updated), 0600); err != nil { return err } } return runApparmor(APPARMOR_CMD_LOAD, c) }
c177025
:= path.Join("/sys/kernel/security/apparmor/policy/namespaces", AANamespace(c)) if err := os.Remove(p); err != nil { logger.Error("Error removing apparmor namespace", log.Ctx{"err": err, "ns": p}) } } return runApparmor(APPARMOR_CMD_UNLOAD, c) }
c177026
if !state.OS.AppArmorAvailable { return nil } return runApparmor(APPARMOR_CMD_PARSE, c) }
c177027
log.Format) log.Handler { return nil }
c177028
:= client.GetHTTPClient() if err != nil { return errors.Wrap(err, "failed to get HTTP client") } response, err := httpClient.Do(request) if err != nil { return errors.Wrap(err, "failed to notify node about completed upgrade") } if response.StatusCode != http.StatusOK { return fmt.Errorf("database upgrade notification failed: %s", response.Status) } return nil }) }
c177029
select { case <-ctx.Done(): case <-ch: } } schedule := task.Every(5 * time.Minute) return f, schedule }
c177030
} logger.Infof("Node is out-of-date with respect to other cluster nodes") updateExecutable := os.Getenv("LXD_CLUSTER_UPDATE") if updateExecutable == "" { logger.Debug("No LXD_CLUSTER_UPDATE variable set, skipping auto-update") return } logger.Infof("Triggering cluster update using: %s", updateExecutable) _, err = shared.RunCommand(updateExecutable) if err != nil { logger.Errorf("Cluster upgrade failed: '%v'", err.Error()) return } }
c177031
permissionsLock: &sync.Mutex{}, } // var keyPair bakery.KeyPair keyPair.Private.UnmarshalText([]byte(agentPrivateKey)) keyPair.Public.UnmarshalText([]byte(agentPublicKey)) r.client = httpbakery.NewClient() authInfo := agent.AuthInfo{ Key: &keyPair, Agents: []agent.Agent{ { URL: agentAuthURL, Username: agentUsername, }, }, } err := agent.SetUpAuth(r.client, &authInfo) if err != nil { return nil, err } r.client.Client.Jar, err = cookiejar.New(nil) if err != nil { return nil, err } return &r, nil }
c177032
<-r.statusDone: return case <-time.After(time.Minute): if r.hasStatusChanged() { r.flushCache() } } } }() }
c177033
Identifier: strconv.FormatInt(id, 10), }) resourcesMap[name] = strconv.FormatInt(id, 10) } // Update RBAC err = r.postResources(resources, nil, true) if err != nil { return err } // Update project map r.resourcesLock.Lock() r.resources = resourcesMap r.resourcesLock.Unlock() return nil }
c177034
} // Update project map r.resourcesLock.Lock() r.resources[name] = strconv.FormatInt(id, 10) r.resourcesLock.Unlock() return nil }
c177035
k, v := range r.resources { if v == strconv.FormatInt(id, 10) { delete(r.resources, k) break } } r.resourcesLock.Unlock() return nil }
c177036
return r.AddProject(id, name) }
c177037
permissions are cached _, cached := r.permissions[username] if !cached { r.syncPermissions(username) } return shared.StringInSlice("admin", r.permissions[username][""]) }
c177038
r.resourcesLock.Lock() permissions := r.permissions[username][r.resources[project]] r.resourcesLock.Unlock() return shared.StringInSlice(permission, permissions) }
c177039
cmd.Process.Kill() cmd.Wait() return fmt.Errorf("Failed to rsync: %v\n%s", err, output) } err = cmd.Wait() <-readDone <-writeDone if err != nil { return fmt.Errorf("Failed to rsync: %v\n%s", err, output) } return nil }
c177040
err := version.Parse(min) if err != nil { return false } return curVer.Compare(minVer) >= 0 } if rsyncCheckVersion("3.1.0") { args = append(args, "--ignore-missing-args") } if rsyncArgs != "" { args = append(args, strings.Split(rsyncArgs, " ")...) } args = append(args, []string{path, "localhost:/tmp/foo"}...) args = append(args, []string{"-e", rsyncCmd}...) cmd := exec.Command("rsync", args...) cmd.Stdout = os.Stderr stderr, err := cmd.StderrPipe() if err != nil { return nil, nil, nil, err } if err := cmd.Start(); err != nil { return nil, nil, nil, err } conn, err := l.Accept() if err != nil { cmd.Process.Kill() cmd.Wait() return nil, nil, nil, err } l.Close() return cmd, conn, stderr, nil }
c177041
if err != nil { return nil, err } cert.IsCA = true cert.KeyUsage = x509.KeyUsageCertSign config.RootCAs.AddCert(cert) if cert.DNSNames != nil { config.ServerName = cert.DNSNames[0] } return config, nil }
c177042
keypair material: %v", err)) } trustedCerts := map[string]x509.Certificate{"0": *cert} trusted, _ := util.CheckTrustState(*r.TLS.PeerCertificates[0], trustedCerts) return r.TLS != nil && trusted }
c177043
:= mux.Vars(r)["name"] err := containerPostCreateContainerMountPoint(d, project, containerName) if err != nil { return SmartError(err) } return EmptySyncResponse }
c177044
node") } for _, snapshotName := range snapshotNames { mntPoint := getSnapshotMountPoint(project, poolName, snapshotName) snapshotsSymlinkTarget := shared.VarPath("storage-pools", poolName, "containers-snapshots", containerName) snapshotMntPointSymlink := shared.VarPath("snapshots", containerName) err := createSnapshotMountpoint(mntPoint, snapshotsSymlinkTarget, snapshotMntPointSymlink) if err != nil { return errors.Wrap(err, "Failed to create snapshot mount point on target node") } } return nil }
c177045
return false } old := list[k] return deviceEquals(old, d) }
c177046
Device err := shared.DeepCopy(&srcOldDevice, &oldDevice) if err != nil { continue } srcNewDevice := newlist[key] var newDevice Device err = shared.DeepCopy(&srcNewDevice, &newDevice) if err != nil { continue } updateDiff = deviceEqualsDiffKeys(oldDevice, newDevice) for _, k := range []string{"limits.max", "limits.read", "limits.write", "limits.egress", "limits.ingress", "ipv4.address", "ipv6.address", "ipv4.routes", "ipv6.routes"} { delete(oldDevice, k) delete(newDevice, k) } if deviceEquals(oldDevice, newDevice) { delete(rmlist, key) delete(addlist, key) updatelist[key] = d } } return rmlist, addlist, updatelist, updateDiff }
c177047
= append(sortable, namedDevice{k, d}) } sort.Sort(sortable) return sortable.Names() }
c177048
Log.Info(fmt.Sprintf(format, args...)) } }
c177049
Log.Debug(fmt.Sprintf(format, args...)) } }
c177050
Log.Warn(fmt.Sprintf(format, args...)) } }
c177051
Log.Error(fmt.Sprintf(format, args...)) } }
c177052
Log.Crit(fmt.Sprintf(format, args...)) } }
c177053
== "info" { return } } err := eventBroadcast("", event, true) if err != nil { logger.Warnf("Failed to forward event from node %d: %v", id, err) } }
c177054
} readPipe := &ioprogress.ProgressReader{ ReadCloser: reader, Tracker: &ioprogress.ProgressTracker{ Handler: progress, }, } return readPipe } }
c177055
speedInt) } writePipe := &ioprogress.ProgressWriter{ WriteCloser: writer, Tracker: &ioprogress.ProgressTracker{ Handler: progress, }, } return writePipe } }
c177056
if os.IsNotExist(err) { return getLSBRelease("/usr/lib/os-release") } return osRelease, err }
c177057
if path == "-" { _, err = os.Stdout.Write(bytes) } else { err = ioutil.WriteFile(path, []byte(content), 0644) } if err != nil { errors.Wrapf(err, "Reset target source file '%s'", path) } return nil }
c177058
bytes, err := buffer.code() if err != nil { return err } _, err = file.Write(bytes) if err != nil { return errors.Wrapf(err, "Append snippet to target source code file '%s'", path) } return nil }
c177059
Ephemeral: container.Ephemeral, CreationDate: container.CreationDate, Stateful: container.Stateful, LastUsedDate: container.LastUseDate, Description: container.Description, Config: container.Config, Devices: container.Devices, Profiles: container.Profiles, ExpiryDate: container.ExpiryDate, } if args.Devices == nil { args.Devices = types.Devices{} } return args }
c177060
WHERE projects.name = ? AND containers.type = ? ` return query.SelectStrings(c.tx, stmt, project, CTypeRegular) }
c177061
"", ErrNoSuchObject } err = rows.Scan(&id, &address) if err != nil { return "", err } if rows.Next() { return "", fmt.Errorf("more than one node associated with container") } err = rows.Err() if err != nil { return "", err } if id == c.nodeID { return "", nil } return address, nil }
c177062
:= c.tx.Query(stmt, CTypeRegular, project) if err != nil { return nil, err } defer rows.Close() result := map[string][]string{} for i := 0; rows.Next(); i++ { var name string var nodeAddress string var nodeID int64 var nodeHeartbeat time.Time err := rows.Scan(&name, &nodeID, &nodeAddress, &nodeHeartbeat) if err != nil { return nil, err } if nodeID == c.nodeID { nodeAddress = "" } else if nodeIsOffline(offlineThreshold, nodeHeartbeat) { nodeAddress = "0.0.0.0" } result[nodeAddress] = append(result[nodeAddress], name) } err = rows.Err() if err != nil { return nil, err } return result, nil }
c177063
for i, container := range containers { profiles := make([]api.Profile, len(container.Profiles)) for j, name := range container.Profiles { profile := profilesByProjectAndName[container.Project][name] profiles[j] = *ProfileToAPI(&profile) } containers[i].Config = ProfilesExpandConfig(container.Config, profiles) containers[i].Devices = ProfilesExpandDevices(container.Devices, profiles) } return containers, nil }
c177064
:= 0; rows.Next(); i++ { var name string var nodeName string err := rows.Scan(&name, &nodeName) if err != nil { return nil, err } result[name] = nodeName } err = rows.Err() if err != nil { return nil, err } return result, nil }
c177065
dest, length, prefix, CTypeSnapshot) if err != nil { return nil, err } result := make(map[int]string) for i := range objects { result[objects[i].ID] = strings.Split(objects[i].Name, shared.SnapshotDelimiter)[1] } return result, nil }
c177066
} filter := ContainerFilter{ Node: node, Type: int(CTypeRegular), } return c.ContainerList(filter) }
c177067
project, Node: node, Type: int(CTypeRegular), } return c.ContainerList(filter) }
c177068
{ return tx.ContainerDelete(project, name) }) }
c177069
[]interface{}{&project, &name} err := dbQueryRowScan(c.db, q, arg1, arg2) if err == sql.ErrNoRows { return "", "", ErrNoSuchObject } return project, name, err }
c177070
JOIN containers_devices ON containers_devices_config.container_device_id=containers_devices.id WHERE containers_devices.container_id=?)`, id) if err != nil { return err } _, err = tx.Exec("DELETE FROM containers_devices WHERE container_id=?", id) return err }
c177071
value := "" arg1 := []interface{}{id, key} arg2 := []interface{}{&value} err := dbQueryRowScan(c.db, q, arg1, arg2) if err == sql.ErrNoRows { return "", ErrNoSuchObject } return value, err }
c177072
containers_config WHERE key=? AND container_id=?", key, id) return err }
c177073
stateful { statefulInt = 1 } err := exec(c.db, "UPDATE containers SET stateful=? WHERE id=?", statefulInt, id) return err }
c177074
?, (SELECT profiles.id FROM profiles JOIN projects ON projects.id=profiles.project_id WHERE projects.name=? AND profiles.name=?), ? ) ` stmt, err := tx.Prepare(str) if err != nil { return err } defer stmt.Close() for _, profile := range profiles { _, err = stmt.Exec(id, project, profile, applyOrder) if err != nil { logger.Debugf("Error adding profile %s to container: %s", profile, err) return err } applyOrder = applyOrder + 1 } return nil }
c177075
outfmt := []interface{}{name} results, err := queryScan(c.db, query, inargs, outfmt) if err != nil { return nil, err } for _, r := range results { name = r[0].(string) profiles = append(profiles, name) } return profiles, nil }
c177076
a slice here, not db Rows anymore. results, err := queryScan(c.db, q, inargs, outfmt) if err != nil { return nil, err //SmartError will wrap this and make "not found" errors pretty } config := map[string]string{} for _, r := range results { key = r[0].(string) value = r[1].(string) config[key] = value } return config, nil }
c177077
nil { return err } defer stmt.Close() if _, err = stmt.Exec(id, state); err != nil { return err } return nil }) return err }
c177078
if expiryDate.IsZero() { _, err = stmt.Exec(description, architecture, ephemeralInt, "", id) } else { _, err = stmt.Exec(description, architecture, ephemeralInt, expiryDate, id) } if err != nil { return err } return nil }
c177079
stmt := `UPDATE containers SET last_use_date=? WHERE id=?` err := exec(c.db, stmt, date, id) return err }
c177080
dbResults, err := queryScan(c.db, q, inargs, outfmt) if err != nil { return result, err } for _, r := range dbResults { result = append(result, r[0].(string)) } return result, nil }
c177081
name, Project: project, Type: int(CTypeSnapshot), } return c.ContainerList(filter) }
c177082
r := range results { snapOnlyName := strings.SplitN(r[0].(string), shared.SnapshotDelimiter, 2)[1] fields := strings.SplitN(pattern, "%d", 2) var num int count, err := fmt.Sscanf(snapOnlyName, fmt.Sprintf("%s%%d%s", fields[0], fields[1]), &num) if err != nil || count != 1 { continue } if num >= max { max = num + 1 } } return max }
c177083
storage_volumes.name=? AND storage_volumes.type=? ` inargs := []interface{}{project, c.nodeID, containerName, StoragePoolVolumeTypeContainer} outargs := []interface{}{&poolName} err := c.tx.QueryRow(query, inargs...).Scan(outargs...) if err != nil { if err == sql.ErrNoRows { return "", ErrNoSuchObject } return "", err } return poolName, nil }
c177084
&args.ExpiryDate, &containerOnlyInt, &optimizedStorageInt} err := dbQueryRowScan(c.db, q, arg1, arg2) if err != nil { if err == sql.ErrNoRows { return args, ErrNoSuchObject } return args, err } if containerOnlyInt == 1 { args.ContainerOnly = true } if optimizedStorageInt == 1 { args.OptimizedStorage = true } return args, nil }
c177085
projects.id=containers.project_id WHERE projects.name=? AND containers.name=?` inargs := []interface{}{project, name} outfmt := []interface{}{name} dbResults, err := queryScan(c.db, q, inargs, outfmt) if err != nil { return nil, err } for _, r := range dbResults { result = append(result, r[0].(string)) } return result, nil }
c177086
defer stmt.Close() result, err := stmt.Exec(args.ContainerID, args.Name, args.CreationDate.Unix(), args.ExpiryDate.Unix(), containerOnlyInt, optimizedStorageInt) if err != nil { return err } _, err = result.LastInsertId() if err != nil { return fmt.Errorf("Error inserting %s into database", args.Name) } return nil }) return err }
c177087
FROM containers_backups WHERE id=?", id) if err != nil { return err } return nil }
c177088
"query": "UPDATE containers_backups SET name = ? WHERE name = ?", "oldName": oldName, "newName": newName}) if _, err := stmt.Exec(newName, oldName); err != nil { return err } return nil }) return err }
c177089
err = backupExpiry.UnmarshalText([]byte(timestamp.(string))) if err != nil { return []string{}, err } if backupExpiry.IsZero() { // Backup doesn't expire continue } // Backup has expired if time.Now().Unix()-backupExpiry.Unix() >= 0 { result = append(result, r[0].(string)) } } return result, nil }
c177090
newOS.InotifyWatch.Fd = -1 newOS.InotifyWatch.Targets = make(map[string]*InotifyTargetInfo) return newOS }
c177091
log.Ctx{"err": err}) } s.IdmapSet = util.GetIdmapSet() s.ExecPath = util.GetExecPath() s.RunningInUserNS = shared.RunningInUserNS() s.initAppArmor() s.initCGroup() return nil }
c177092
op.r.GetOperationWebsocket(op.ID, secret) }
c177093
:= op.r.GetOperation(op.ID) if err != nil { return err } // Update the operation struct op.Operation = *newOp return nil }
c177094
== nil { return fmt.Errorf("No associated target operation") } return op.targetOp.Cancel() }
c177095
target operation") } opAPI := op.targetOp.Get() return &opAPI, nil }
c177096
// Errors here are not fatal and are just logged. e.listeners[network] = networkCreateListener(config.NetworkAddress, e.cert) isCovered := util.IsAddressCovered(config.ClusterAddress, config.NetworkAddress) if config.ClusterAddress != "" && !isCovered { e.listeners[cluster], err = clusterCreateListener(config.ClusterAddress, e.cert) if err != nil { return err } logger.Infof("Starting cluster handler:") e.serveHTTP(cluster) } } if config.DebugAddress != "" { e.listeners[pprof], err = pprofCreateListener(config.DebugAddress) if err != nil { return err } logger.Infof("Starting pprof handler:") e.serveHTTP(pprof) } logger.Infof("Starting /dev/lxd handler:") e.serveHTTP(devlxd) logger.Infof("REST API daemon:") e.serveHTTP(local) e.serveHTTP(network) return nil }
c177097
{ logger.Infof("Stopping /dev/lxd handler:") err := e.closeListener(devlxd) if err != nil { return err } } if e.listeners[pprof] != nil { logger.Infof("Stopping pprof handler:") err := e.closeListener(pprof) if err != nil { return err } } if e.tomb != nil { e.tomb.Kill(nil) e.tomb.Wait() } return nil }
c177098
of the tomb, so Down() doesn't wait on it unless // we actually have spawned at least a server. if e.tomb == nil { e.tomb = &tomb.Tomb{} } e.tomb.Go(func() error { server.Serve(listener) return nil }) }
c177099
{ return nil } delete(e.listeners, kind) logger.Info(" - closing socket", log.Ctx{"socket": listener.Addr()}) return listener.Close() }