id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c164400 | is ever returned.
rs, _ := s.Routez(opts)
b, err := json.MarshalIndent(rs, "", " ")
if err != nil {
s.Errorf("Error marshaling response to /routez request: %v", err)
}
// Handle response
ResponseHandler(w, r, b)
} | |
c164401 | if test && !matchLiteral(testSub, string(sub.subject)) {
continue
}
if sub.client == nil {
continue
}
sub.client.mu.Lock()
details[i] = SubDetail{
Subject: string(sub.subject),
Queue: string(sub.queue),
Sid: string(sub.sid),
Msgs: sub.nm,
Max: sub.max,
Cid: ... | |
c164402 | b []byte
if len(st.Subs) == 0 {
b, err = json.MarshalIndent(st.SublistStats, "", " ")
} else {
b, err = json.MarshalIndent(st, "", " ")
}
if err != nil {
s.Errorf("Error marshaling response to /subscriptionsz request: %v", err)
}
// Handle response
ResponseHandler(w, r, b)
} | |
c164403 | {
n = runtime.Stack(buf, true)
if n < size {
break
}
size *= 2
buf = make([]byte, size)
}
// Handle response
ResponseHandler(w, r, buf[:n])
} | |
c164404 | </style>
</head>
<body>
<img src="http://nats.io/img/logo.png" alt="NATS">
<br/>
<a href=/varz>varz</a><br/>
<a href=/connz>connz</a><br/>
<a href=/routez>routez</a><br/>
<a href=/subsz>subsz</a><br/>
<br/>
<a href=http://nats.io/documentation/server/gnatsd-monitoring/>help</a>
</body>
</h... | |
c164405 |
v.InBytes = atomic.LoadInt64(&s.inBytes)
v.OutMsgs = atomic.LoadInt64(&s.outMsgs)
v.OutBytes = atomic.LoadInt64(&s.outBytes)
v.SlowConsumers = atomic.LoadInt64(&s.slowConsumers)
v.MaxPending = opts.MaxPending
v.WriteDeadline = opts.WriteDeadline
// FIXME(dlc) - make this multi-account aware.
v.Subscriptions = ... | |
c164406 | if err != nil {
s.Errorf("Error marshaling response to /varz request: %v", err)
}
// Handle response
ResponseHandler(w, r, b)
} | |
c164407 | fmt.Fprintf(w, "%s(%s)", callback, data)
} else {
// Otherwise JSON
w.Header().Set("Content-Type", "application/json")
w.Write(data)
}
} | |
c164408 | = (t.newValue.ClientAuth == tls.RequireAndVerifyClientCert)
message = "enabled"
}
server.mu.Unlock()
server.Noticef("Reloaded: tls = %s", message)
} | |
c164409 | server.routeInfo.ClientConnectURLs = server.clientConnectURLs
}
server.setRouteInfoHostPortAndIP()
server.mu.Unlock()
server.Noticef("Reloaded: cluster")
if tlsRequired && c.newValue.TLSConfig.InsecureSkipVerify {
server.Warnf(clusterTLSInsecureWarning)
}
} | |
c164410 | if url != nil && urlsAreEqual(url, remove) {
// Do not attempt to reconnect when route is removed.
client.setNoReconnect()
client.closeConnection(RouteRemoved)
server.Noticef("Removed route %v", remove)
}
}
}
// Add routes.
server.solicitRoutes(r.add)
server.Noticef("Reloaded: cluster routes... | |
c164411 | closed = 0
)
for _, client := range clients {
client.maxConnExceeded()
closed++
if closed >= numClose {
break
}
}
server.Noticef("Closed %d connections to fall within max_connections", closed)
}
server.Noticef("Reloaded: max_connections = %v", m.newValue)
} | |
c164412 | pidfile: %v", err)
}
server.Noticef("Reloaded: pid_file = %v", p.newValue)
} | |
c164413 | mcl)
}
server.mu.Unlock()
server.Noticef("Reloaded: max_control_line = %d", mcl)
} | |
c164414 | client := range server.clients {
atomic.StoreInt32(&client.mpay, int32(m.newValue))
}
server.mu.Unlock()
server.Noticef("Reloaded: max_payload = %d", m.newValue)
} | |
c164415 |
server.mu.Unlock()
server.Noticef("Reload: client_advertise = %s", c.newValue)
} | |
c164416 | accept loop was
// created.
if newOpts.Port == 0 {
newOpts.Port = clientOrgPort
}
// We don't do that for cluster, so check against -1.
if newOpts.Cluster.Port == -1 {
newOpts.Cluster.Port = clusterOrgPort
}
if newOpts.Gateway.Port == -1 {
newOpts.Gateway.Port = gatewayOrgPort
}
if newOpts.LeafNode.Port... | |
c164417 |
return err
}
// Create a context that is used to pass special info that we may need
// while applying the new options.
ctx := reloadContext{oldClusterPerms: curOpts.Cluster.Permissions}
s.setOpts(newOpts)
s.applyOptions(&ctx, changed)
return nil
} | |
c164418 | = routesa[:0]
)
for _, client := range s.clients {
if s.clientHasMovedToDifferentAccount(client) {
cclients = append(cclients, client)
} else {
clients = append(clients, client)
}
}
for _, route := range s.routes {
routes = append(routes, route)
}
s.mu.Unlock()
// Close clients that have moved ... | |
c164419 | Validate Cluster.Advertise syntax
if new.Advertise != "" {
if _, _, err := parseHostPort(new.Advertise, 0); err != nil {
return fmt.Errorf("invalid Cluster.Advertise value of %s, err=%v", new.Advertise, err)
}
}
return nil
} | |
c164420 | new {
for _, oldRoute := range old {
if urlsAreEqual(oldRoute, newRoute) {
continue addLoop
}
}
add = append(add, newRoute)
}
return add, remove
} | |
c164421 | if dec < asciiZero || dec > asciiNine {
return -1
}
n = n*10 + (int(dec) - asciiZero)
i++
if i < l {
goto loop
}
return n
} | |
c164422 | seconds * float64(time.Second)
return time.Duration(ttl)
} | |
c164423 | reflect.DeepEqual(u1, u2)
} | |
c164424 | err != nil {
return errorConn{err}
}
return &activeConn{p: p, pc: pc}
} | |
c164425 | return errorConn{err}, err
}
return &activeConn{p: p, pc: pc}, nil
} | |
c164426 | IdleCount: p.idle.count,
WaitCount: p.waitCount,
WaitDuration: p.waitDuration,
}
p.mu.Unlock()
return stats
} | |
c164427 |
p.mu.Unlock()
return active
} | |
c164428 |
p.mu.Unlock()
return idle
} | |
c164429 | {
cwt, ok := c.(ConnWithTimeout)
if !ok {
return nil, errTimeoutNotSupported
}
return cwt.DoWithTimeout(timeout, cmd, args...)
} | |
c164430 | return nil, errTimeoutNotSupported
}
return cwt.ReceiveWithTimeout(timeout)
} | |
c164431 | return &Script{keyCount, src, hex.EncodeToString(h.Sum(nil))}
} | |
c164432 | c.Send("EVALSHA", s.args(s.hash, keysAndArgs)...)
} | |
c164433 | c.Send("EVAL", s.args(s.src, keysAndArgs)...)
} | |
c164434 | c.Do("SCRIPT", "LOAD", s.src)
return err
} | |
c164435 | *dialOptions) {
do.readTimeout = d
}}
} | |
c164436 | *dialOptions) {
do.writeTimeout = d
}}
} | |
c164437 | *dialOptions) {
do.dialer.Timeout = d
}}
} | |
c164438 | *dialOptions) {
do.dialer.KeepAlive = d
}}
} | |
c164439 | return DialOption{func(do *dialOptions) {
do.dial = dial
}}
} | |
c164440 | DialOption{func(do *dialOptions) {
do.db = db
}}
} | |
c164441 | *dialOptions) {
do.password = password
}}
} | |
c164442 | *dialOptions) {
do.clientName = name
}}
} | |
c164443 |
return DialOption{func(do *dialOptions) {
do.tlsConfig = c
}}
} | |
c164444 | *dialOptions) {
do.skipVerify = skip
}}
} | |
c164445 | DialOption{func(do *dialOptions) {
do.useTLS = useTLS
}}
} | |
c164446 |
c := &conn{
conn: netConn,
bw: bufio.NewWriter(netConn),
br: bufio.NewReader(netConn),
readTimeout: do.readTimeout,
writeTimeout: do.writeTimeout,
}
if do.password != "" {
if _, err := c.Do("AUTH", do.password); err != nil {
netConn.Close()
return nil, err
}
}
if... | |
c164447 | netConn,
bw: bufio.NewWriter(netConn),
br: bufio.NewReader(netConn),
readTimeout: readTimeout,
writeTimeout: writeTimeout,
}
} | |
c164448 | bufio.ErrBufferFull {
p, err = c.br.ReadSlice('\n')
buf = append(buf, p...)
}
p = buf
}
if err != nil {
return nil, err
}
i := len(p) - 2
if i < 0 || p[i] != '\r' {
return nil, protocolError("bad response line terminator")
}
return p[:i], nil
} | |
c164449 | if b < '0' || b > '9' {
return -1, protocolError("illegal bytes in length")
}
n += int(b - '0')
}
return n, nil
} | |
c164450 | p}
c.ids = c.buf[:0]
return c
} | |
c164451 | error {
c.Conn.Send("SUBSCRIBE", channel...)
return c.Conn.Flush()
} | |
c164452 | error {
c.Conn.Send("PSUBSCRIBE", channel...)
return c.Conn.Flush()
} | |
c164453 | error {
c.Conn.Send("UNSUBSCRIBE", channel...)
return c.Conn.Flush()
} | |
c164454 | error {
c.Conn.Send("PUNSUBSCRIBE", channel...)
return c.Conn.Flush()
} | |
c164455 | {
c.Conn.Send("PING", data)
return c.Conn.Flush()
} | |
c164456 | c.receiveInternal(ReceiveWithTimeout(c.Conn, timeout))
} | |
c164457 | }
case reflect.Map:
for _, k := range rv.MapKeys() {
args = append(args, k.Interface(), rv.MapIndex(k).Interface())
}
case reflect.Ptr:
if rv.Type().Elem().Kind() == reflect.Struct {
if !rv.IsNil() {
args = flattenStruct(args, rv.Elem())
}
} else {
args = append(args, v)
}
default:
args ... | |
c164458 |
if prefix != "" {
prefix = prefix + "."
}
return &loggingConn{conn, logger, prefix, nil}
} | |
c164459 | {
prefix = prefix + "."
}
return &loggingConn{conn, logger, prefix, skip}
} | |
c164460 | t.postStart {
c.Close()
}
return nil
} | |
c164461 |
}
pack, name := parseFunctionName(fn.Name())
return Frame{
Line: line,
File: filepath.Base(file),
Package: pack,
Function: name,
}
} | |
c164462 | if fields[2] != systemField {
return 0, 0, fmt.Errorf("unexpected field %q in %q, expected %q", fields[2], cgroupCpuacctStat, systemField)
}
if userModeUsage, err = strconv.ParseUint(fields[1], 10, 64); err != nil {
return 0, 0, err
}
if kernelModeUsage, err = strconv.ParseUint(fields[3], 10, 64); err != nil {... | |
c164463 | c.bounding...)
return c.pid.Apply(capability.BOUNDS)
} | |
c164464 |
c.pid.Set(capability.EFFECTIVE, c.effective...)
c.pid.Set(capability.AMBIENT, c.ambient...)
return c.pid.Apply(allCapabilityTypes)
} | |
c164465 | cause,
Stack: stacktrace.Capture(2),
}
if err != nil {
gerr.Message = err.Error()
}
return gerr
} | |
c164466 | := range uidmap {
if um.ID <= euid && euid <= um.ID+um.Count-1 {
return um.ParentID + euid - um.ID
}
}
return euid
} | |
c164467 | the
// API must be able to deal with being inside as well as outside the
// container. It's just cleaner to do this here (at the expense of the
// operation not being perfectly split).
if err := unix.Chdir(config.Rootfs); err != nil {
return newSystemErrorWithCausef(err, "changing dir to %q", config.Rootfs)
}
... | |
c164468 | }
// set rootfs ( / ) as readonly
if config.Readonlyfs {
if err := setReadonly(); err != nil {
return newSystemErrorWithCause(err, "setting rootfs as readonly")
}
}
unix.Umask(0022)
return nil
} | |
c164469 | // containers running in a user namespace are not allowed to mknod
// devices so we can just bind mount it from the host.
if err := createDeviceNode(config.Rootfs, node, useBindMount); err != nil {
unix.Umask(oldMask)
return err
}
}
unix.Umask(oldMask)
return nil
} | |
c164470 | return err
}
if bind {
return bindMountDeviceNode(dest, node)
}
if err := mknodDevice(dest, node); err != nil {
if os.IsExist(err) {
return nil
} else if os.IsPermission(err) {
return bindMountDeviceNode(dest, node)
}
return err
}
return nil
} | |
c164471 | nil
}
if path == "/" {
break
}
}
// If we are here, we did not find parent mount. Something is wrong.
return "", "", fmt.Errorf("Could not find parent mount of %s", rootfs)
} | |
c164472 | First of all pivot_root() will fail if parent mount is
// shared. Secondly when we bind mount rootfs it will propagate to
// parent namespace and we don't want that to happen.
if sharedMount {
return unix.Mount("", parentMount, "", unix.MS_PRIVATE, "")
}
return nil
} | |
c164473 | := unix.Fchdir(oldroot); err != nil {
return err
}
// Make oldroot rslave to make sure our unmounts don't propagate to the
// host (and thus bork the machine). We don't use rprivate because this is
// known to cause issues due to races where we still have a reference to a
// mount while a process in the host n... | |
c164474 | return err
}
return unix.Mount(path, path, "", unix.MS_BIND|unix.MS_REMOUNT|unix.MS_RDONLY|unix.MS_REC, "")
} | |
c164475 | | unix.MS_RDONLY
if err := unix.Mount("", dest, "", uintptr(flags), ""); err != nil {
switch err {
case unix.EBUSY:
time.Sleep(100 * time.Millisecond)
continue
default:
return err
}
}
return nil
}
return fmt.Errorf("unable to mount %s as readonly max retries reached", dest)
} | |
c164476 | }
if err := unix.Mount(m.Source, dest, m.Device, uintptr(flags), data); err != nil {
return err
}
for _, pflag := range m.PropagationFlags {
if err := unix.Mount("", dest, "", uintptr(pflag), ""); err != nil {
return err
}
}
return nil
} | |
c164477 | err = filepath.Abs(args[0]); err != nil {
return newGenericError(err, ConfigInvalid)
}
}
l.InitArgs = args
return nil
}
} | |
c164478 | paths map[string]string) cgroups.Manager {
return &systemd.Manager{
Cgroups: config,
Paths: paths,
}
}
return nil
} | |
c164479 | paths map[string]string) cgroups.Manager {
return &fs.Manager{
Cgroups: config,
Paths: paths,
}
}
return nil
} | |
c164480 |
return err
}
if !mounted {
if err := unix.Mount("tmpfs", l.Root, "tmpfs", 0, ""); err != nil {
return err
}
}
return nil
} | |
c164481 | {
return func(l *LinuxFactory) error {
l.CriuPath = criupath
return nil
}
} | |
c164482 | []string{os.Args[0], "init"},
Validator: validate.New(),
CriuPath: "criu",
}
Cgroupfs(l)
for _, opt := range options {
if opt == nil {
continue
}
if err := opt(l); err != nil {
return nil, err
}
}
return l, nil
} | |
c164483 | env vars.
os.Clearenv()
defer func() {
// We have an error during the initialization of the container's init,
// send it back to the parent process in the form of an initError.
if werr := utils.WriteJSON(pipe, syncT{procError}); werr != nil {
fmt.Fprintln(os.Stderr, err)
return
}
if werr := utils.Wr... | |
c164484 | l.NewuidmapPath = newuidmapPath
return nil
}
} | |
c164485 | l.NewgidmapPath = newgidmapPath
return nil
}
} | |
c164486 | }
}
spec, err := loadSpec(specConfig)
if err != nil {
return nil, err
}
return spec, nil
} | |
c164487 | 0)
if err != nil {
return nil, nil, err
}
return os.NewFile(uintptr(fds[1]), name+"-p"), os.NewFile(uintptr(fds[0]), name+"-c"), nil
} | |
c164488 | return "", err
}
return filepath.EvalSymlinks(rootfs)
} | |
c164489 | return err
}
_, err = w.Write(data)
return err
} | |
c164490 | strings.SplitN(l, "=", 2)
if len(parts) < 2 {
continue
}
if parts[0] == query {
return parts[1]
}
}
return ""
} | |
c164491 |
continue
}
if parts[0] == "bundle" {
bundle = parts[1]
} else {
userAnnotations[parts[0]] = parts[1]
}
}
return
} | |
c164492 |
}
return 0, fmt.Errorf("string %s is not a valid operator for seccomp", in)
} | |
c164493 |
}
return "", fmt.Errorf("string %s is not a valid arch for seccomp", in)
} | |
c164494 | s.socketPath, Options: []string{"bind"}}
spec.Mounts = append(spec.Mounts, mount)
spec.Process.Env = append(spec.Process.Env, fmt.Sprintf("NOTIFY_SOCKET=%s", s.host))
} | |
c164495 | _, err = client.Write(out.Bytes())
if err != nil {
return
}
// now we can inform systemd to use pid1 as the pid to monitor
if pid1 > 0 {
newPid := fmt.Sprintf("MAINPID=%d\n", pid1)
client.Write([]byte(newPid))
}
return
}
}
}
} | |
c164496 | allMap := make(map[string]bool)
for s := range allSubsystems {
allMap[s] = false
}
return getCgroupMountsHelper(allMap, f, all)
} | |
c164497 | must contain at least two colons: %v", text)
}
for _, subs := range strings.Split(parts[1], ",") {
cgroups[subs] = parts[2]
}
}
if err := s.Err(); err != nil {
return nil, err
}
return cgroups, nil
} | |
c164498 | removed
// cgroups
if os.IsNotExist(err) {
delete(paths, s)
}
}
if len(paths) == 0 {
return nil
}
}
return fmt.Errorf("Failed to remove paths: %v", paths)
} | |
c164499 | }
cPids, err := readProcsFile(dir)
if err != nil {
return err
}
pids = append(pids, cPids...)
return nil
})
return pids, err
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.