id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c16800
if err != nil { return err } c.Cluster = temp.Cluster c.Config = temp.Config return nil }
c16801
c.getCancelable(endpoint, nil) }
c16802
c.Cluster.Leader) p := endpoint req := NewRawRequest("PUT", p, body, nil) resp, err := c.SendRequest(req) if err != nil { return nil, err } return resp, nil }
c16803
value != "" { v.Set("value", value) } if ttl > 0 { v.Set("ttl", fmt.Sprintf("%v", ttl)) } return v }
c16804
:= transform.Bytes(e, s) if err != nil { return s } return es }
c16805
:= transform.Bytes(e, s) if err != nil { return s } return es }
c16806
[]UDH{} if data != nil && len(data) > 2 { for i := 0; i < len(data); { udh := UDH{} udh.IEI = Fixed{Data: data[i]} udh.IELength = Fixed{Data: data[i+1]} udh.IEData = Variable{} l := int(data[i+1]) for j := 2; j < l+2; j++ { udh.IEData.Data = append(udh.IEData.Data, data[i+j]) } ...
c16807
DeliverSMResp pResp := pdu.NewDeliverSMRespSeq(p.Header().Seq) t.cl.Write(pResp) } } t.tx.Lock() for _, rc := range t.tx.inflight { rc <- &tx{Err: ErrNotConnected} } t.tx.Unlock() }
c16808
= p.Npi.Raw().(uint8) unDest.Address = string(p.DestAddr.Bytes()) unDest.Error = pdu.Status(binary.BigEndian.Uint32(p.ErrCode.Bytes())) return unDest }
c16809
sm.resp.Unlock() return sm.resp.p }
c16810
p := pdu.NewSubmitMulti(sm.TLVFields) return t.submitMsgMulti(sm, p, uint8(sm.Text.Type())) } p := pdu.NewSubmitSM(sm.TLVFields) return t.submitMsg(sm, p, uint8(sm.Text.Type())) }
c16811
want %d, have %d", ft.Hex(), fl, r.Len()) } b = r.Next(int(fl)) t[ft] = &Field{ Tag: ft, Data: b, } } return t, nil }
c16812
r.BindInterval, } r.cl.client = c c.init() go c.Bind() // Set up message merging if requested if r.MergeInterval > 0 { if r.MergeCleanupInterval == 0 { r.MergeCleanupInterval = 1 * time.Second } r.mg.mergeHolders = make(map[int]*MergeHolder) go r.mergeCleaner() } return c.Status }
c16813
l, ID: ID(binary.BigEndian.Uint32(b[4:8])), Status: Status(binary.BigEndian.Uint32(b[8:12])), Seq: binary.BigEndian.Uint32(b[12:16]), } return hdr, nil }
c16814
uint32(h.Status)) binary.BigEndian.PutUint32(b[12:16], h.Seq) _, err := w.Write(b) return err }
c16815
GenericNACKID}) b.init() return b }
c16816
BindReceiverID}) b.init() return b }
c16817
BindTransceiverID}) b.init() return b }
c16818
BindTransmitterID}) b.init() return b }
c16819
BindReceiverRespID}) b.init() return b }
c16820
BindTransceiverRespID}) b.init() return b }
c16821
BindTransmitterRespID}) b.init() return b }
c16822
QuerySMID}) b.init() return b }
c16823
QuerySMRespID}) b.init() return b }
c16824
SubmitSMID}) b.init() for tag, value := range fields { b.t.Set(tag, value) } return b }
c16825
SubmitSMRespID}) b.init() return b }
c16826
SubmitMultiID}) b.init() for tag, value := range fields { b.t.Set(tag, value) } return b }
c16827
SubmitMultiRespID}) b.init() return b }
c16828
DeliverSMID}) b.init() return b }
c16829
DeliverSMRespID}) b.init() return b }
c16830
DeliverSMRespID, Seq: seq}) b.init() return b }
c16831
UnbindID}) b.init() return b }
c16832
UnbindRespID}) b.init() return b }
c16833
EnquireLinkID}) b.init() return b }
c16834
EnquireLinkRespID}) b.init() return b }
c16835
EnquireLinkRespID, Seq: seq}) b.init() return b }
c16836
&Field{ Tag: tag, Data: value } }
c16837
nil { fd = tls.Client(fd, TLS) } c := &conn{ rwc: fd, r: bufio.NewReader(fd), w: bufio.NewWriter(fd), } return c, nil }
c16838
if cs.c != nil { cs.c.Close() } cs.c = c cs.mu.Unlock() }
c16839
ErrNotConnected } err := cs.c.Close() cs.c = nil return err }
c16840
t.EnquireLink, EnquireLinkTimeout: t.EnquireLinkTimeout, RespTimeout: t.RespTimeout, WindowSize: t.WindowSize, RateLimiter: t.RateLimiter, BindInterval: t.BindInterval, } t.cl.client = c c.init() go c.Bind() return c.Status }
c16841
{ // If Seq not set pdu.h.Seq = atomic.AddUint32(&nextSeq, 1) } }
c16842
{ pdu.f, pdu.t = f, t }
c16843
} for _, t := range pdu.t { l += t.Len() } return l }
c16844
return err } } pdu.h.Len = uint32(pdu.Len()) err := pdu.h.SerializeTo(w) if err != nil { return err } _, err = io.Copy(w, &b) return err }
c16845
:= transform.Bytes(e, s) if err != nil { return s } return es }
c16846
:= transform.Bytes(e, s) if err != nil { return s } return es }
c16847
uint16(t)) return hex.EncodeToString(bin) }
c16848
:= transform.Bytes(e.NewEncoder(), s) if err != nil { return s } return es }
c16849
:= transform.Bytes(e.NewDecoder(), s) if err != nil { return s } return es }
c16850
!ok { invalidChars = append(invalidChars, r) } } } return invalidChars }
c16851
invalidBytes = append(invalidBytes, b, e) } } else if _, ok := reverseLookup[b]; !ok { invalidBytes = append(invalidBytes, b) } count++ } return invalidBytes }
c16852
pResp := pdu.NewEnquireLinkRespSeq(p.Header().Seq) err := c.conn.Write(pResp) if err != nil { break } case pdu.EnquireLinkRespID: c.updateEliTime() default: c.inbox <- p } } retry: close(eli) c.conn.Close() close(c.inbox) delayDuration := c.BindInterval if delayDuration...
c16853
case <-c.stop: return nil, io.EOF } }
c16854
c.RateLimiter.Wait(c.lmctx) } return c.conn.Write(w) }
c16855
case <-time.After(time.Second): } } c.conn.Close() }) return nil }
c16856
case <-time.After(d): case <-c.stop: } }
c16857
return time.After(time.Second) } return time.After(c.RespTimeout) }
c16858
if err != nil { return nil, err } h := resp.Header() if h.Status != 0 { return nil, h.Status } return resp, nil }
c16859
en := encoder{} val := reflect.ValueOf(structPtr) if val.Kind() != reflect.Ptr { return nil, errors.New("encode takes a pointer to struct") } en.message(val.Elem()) return en.Bytes(), nil }
c16860
:= template.Must(template.New("protobuf").Funcs(template.FuncMap{ "Fields": ProtoFields, "TypeName": func(f ProtoField) string { return typeName(f, enums, renamer) }, "Options": options, }).Delims("[[", "]]").Parse(protoTemplate)) return t.Execute(w, map[string]interface{}{ "Renamer": renamer, "Enums": ...
c16861
k.String() + "=>" + "(func() interface {})" + "\t" } return s }
c16862
return bu.UnmarshalBinary(buf) } de := decoder{cons} val := reflect.ValueOf(structPtr) // if its NOT a pointer, it is bad return an error if val.Kind() != reflect.Ptr { return errors.New("Decode has been given a non pointer type") } return de.message(buf, val.Elem()) }
c16863
path = append(path, id) field = sval.FieldByIndex(path) if field.Kind() == reflect.Ptr && field.IsNil() { field.Set(reflect.New(field.Type().Elem())) } } } // For more debugging output, uncomment the following three lines. // if fieldi < len(fields){ // fmt.Printf("Decoding FieldName %+v...
c16864
case 2: // length-delimited v, n = binary.Uvarint(buf) if n <= 0 || v > uint64(len(buf)-n) { return nil, errors.New( "bad protobuf length-delimited value") } vb = buf[n : n+int(v) : n+int(v)] buf = buf[n+int(v):] default: return nil, errors.New("unknown protobuf wire-type") } // We've gotten t...
c16865
interface " + t.String()) } return reflect.ValueOf(newfunc()) } // Otherwise, for all concrete types, just instantiate directly. return reflect.New(t) }
c16866
if slval.Len() != len(vb) { return errors.New("array length and buffer length differ") } for i := 0; i < slval.Len(); i++ { // no SetByte method in reflect so has to pass down by uint64 slval.Index(i).SetUint(uint64(vb[i])) } } else { slval.SetBytes(vb) } return nil default: // Other un...
c16867
interface must fulfilled InterfaceMarshaler") } key := val.MarshalID() ir.generators[key] = g }
c16868
_ := ir.generators[key] return g }
c16869
err := os.Chmod(tmp.Name(), perm); err != nil { return "", err } if f.Owner != "" { // We shell out since we don't have a way to look up unix groups natively cmd := exec.Command("chown", f.Owner, tmp.Name()) if err := cmd.Run(); err != nil { return "", err } } if err := os.Rename(tmp.Name(), fullpat...
c16870
io.WriteString(stdin, joined) if err != nil { return err } stdin.Close() stdoutBytes, _ := ioutil.ReadAll(stdout) stderrBytes, _ := ioutil.ReadAll(stderr) err = cmd.Wait() if err != nil { return fmt.Errorf("Call to update-ssh-keys failed with %v: %s %s", err, string(stdoutBytes), string(stderrBytes)) } ...
c16871
append(r.entries, Entry{entryError, message, line}) }
c16872
append(r.entries, Entry{entryWarning, message, line}) }
c16873
append(r.entries, Entry{entryInfo, message, line}) }
c16874
fmt.Sprintf("line %d: %s: %s", e.line, e.kind, e.message) }
c16875
e.kind.String(), "message": e.message, "line": e.line, }) }
c16876
RawFilePermissions: "0644", }} _, err := WriteFile(&file, "/") return err }
c16877
u.DropInDestination(s.root, d), Content: d.Content, RawFilePermissions: "0644", }} _, err := WriteFile(&file, "/") return err }
c16878
range n.children { if c.name == name { return c } } return node{} }
c16879
+ node{Value: reflect.New(c).Elem()}.HumanType() default: return k.String() } }
c16880
node { var n node toNode(value, context, &n) return n }
c16881
return find(yamlKey, key, context) }
c16882
if os.IsNotExist(err) { oldContent = []byte{} } else { return err } } newContent := mergeEnvContents(oldContent, pending) if bytes.Equal(oldContent, newContent) { return nil } ef.File.Content = string(newContent) _, err = WriteFile(ef.File, root) return err }
c16883
s = append(s, k) } sort.Strings(s) return }
c16884
Runtime: true, DropIns: []config.UnitDropIn{{ Name: "20-cloudinit.conf", Content: serviceContents(fe.Fleet), }}, }}} }
c16885
vars { out += fmt.Sprintf("Environment=\"%s\"\n", v) } return out }
c16886
Runtime: true, DropIns: []config.UnitDropIn{{ Name: "20-cloudinit.conf", Content: serviceContents(ee.Locksmith), }}, }}} }
c16887
a valid HTTP scheme. Skipping.", rawurl)} } dataURL := url.String() duration := h.InitialBackoff for retry := 1; retry <= h.MaxRetries; retry++ { log.Printf("Fetching data from %s. Attempt #%d", dataURL, retry) data, err := h.Get(dataURL) switch err.(type) { case ErrNetwork: log.Printf(err.Error()) ...
c16888
`$$`, -1) // "key" -> "val" data = regexp.MustCompile(`([^\\]|^)`+matchKey).ReplaceAllString(data, `${1}`+val) // "\key" -> "key" data = regexp.MustCompile(`\\`+matchKey).ReplaceAllString(data, replKey) } return data }
c16889
if !c.IsValid() { return } if _, err := url.ParseRequestURI(c.String()); err != nil { report.Warning(c.line, "discovery URL is not valid") } }
c16890
err := config.DecodeContent(c.String(), e.String()); err != nil { report.Error(c.line, fmt.Sprintf("content cannot be decoded as %q", e.String())) } } }
c16891
NewContext([]byte{})) checkNodeStructure(cfg, g, report) }
c16892
reflect.Float64 || n == reflect.Int case reflect.Bool, reflect.Slice, reflect.Int: return n == g default: panic(fmt.Sprintf("isCompatible(): unhandled kind %s", g)) } }
c16893
dss = append(dss, digitalocean.NewDatasource(flags.sources.digitalOceanMetadataService)) } if flags.sources.waagent != "" { dss = append(dss, waagent.NewDatasource(flags.sources.waagent)) } if flags.sources.packetMetadataService != "" { dss = append(dss, packet.NewDatasource(flags.sources.packetMetadataService...
c16894
duration = pkg.ExpBackoff(duration, datasourceMaxInterval) } } }(s) } done := make(chan struct{}) go func() { wg.Wait() close(done) }() var s datasource.Datasource select { case s = <-ds: case <-done: case <-time.After(datasourceTimeout): } close(stop) return s }
c16895
cc.WriteFiles[i].Content = string(content) cc.WriteFiles[i].Encoding = "" } return nil }
c16896
if err := AssertValid(cv.Field(i), ft.Tag.Get("valid")); err != nil { err.Field = ft.Name return err } } return nil }
c16897
if m, _ := regexp.MatchString(valid, vs); m { return nil } return &ErrorValid{ Value: vs, Valid: valid, } }
c16898
return validateCloudConfig(userdataBytes, Rules) default: return Report{entries: []Entry{ {kind: entryError, message: `must be "#cloud-config" or begin with "#!"`, line: 1}, }}, nil } }
c16899
&report) if err != nil { return report, err } for _, r := range rules { r(c, &report) } return report, nil }