id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c11000 | return DecodeInto(dst, m, opts...)
} | |
c11001 |
tests := []struct {
ServerName string
Services gauntlet.ServiceSet
Options []thrift.ClientOption
}{
{
ServerName: "ThriftTest",
Services: gauntlet.ThriftTest,
},
{
ServerName: "SecondService",
Services: gauntlet.SecondService,
},
{
ServerName: "Multiplexed",
Services: gau... | |
c11002 | if fc.now.Before(end) {
fc.now = end
}
fc.Unlock()
nap()
} | |
c11003 | fc.now.Before(end) {
fc.now = end
}
fc.Unlock()
nap()
} | |
c11004 | c,
clock: fc,
time: fc.now.Add(d),
}
fc.addTimer(t)
return t
} | |
c11005 | *FakeTimer {
t := fc.FakeTimer(d)
go func() {
<-t.c
f()
}()
nap()
return t
} | |
c11006 | defer fc.Unlock()
return fc.now
} | |
c11007 |
heap.Fix(&t.clock.timers, t.index)
return true
}
heap.Push(&t.clock.timers, t)
return false
} | |
c11008 | }
t.clock.timers.Swap(t.index, len(t.clock.timers)-1)
t.clock.timers.Pop()
heap.Fix(&t.clock.timers, t.index)
return true
} | |
c11009 |
protobuf.ClientParams{
ServiceName: "uber.yarpc.internal.examples.streaming.Hello",
ClientConfig: clientConfig,
Options: options,
},
)}
} | |
c11010 | },
),
},
{
MethodName: "HelloInStream",
Handler: protobuf.NewStreamHandler(
protobuf.StreamHandlerParams{
Handle: handler.HelloInStream,
},
),
},
{
MethodName: "HelloOutStream",
Handler: protobuf.NewStreamHandler(
protobuf.StreamHandlerParams{
... | |
c11011 | s.log.Info("starting transports")
wait := errorsync.ErrorWaiter{}
for _, t := range s.dispatcher.transports {
wait.Submit(s.start(t))
}
if errs := wait.Wait(); len(errs) != 0 {
return s.abort(errs)
}
s.log.Debug("started transports")
return nil
} | |
c11012 | s.dispatcher.outbounds {
wait.Submit(s.start(o.Unary))
wait.Submit(s.start(o.Oneway))
wait.Submit(s.start(o.Stream))
}
if errs := wait.Wait(); len(errs) != 0 {
return s.abort(errs)
}
s.log.Debug("started outbounds")
return nil
} | |
c11013 | for _, i := range s.dispatcher.inbounds {
wait.Submit(s.start(i))
}
if errs := wait.Wait(); len(errs) != 0 {
return s.abort(errs)
}
s.log.Debug("started inbounds")
return nil
} | |
c11014 | s.log.Debug("stopping inbounds")
wait := errorsync.ErrorWaiter{}
for _, ib := range s.dispatcher.inbounds {
wait.Submit(ib.Stop)
}
if errs := wait.Wait(); len(errs) > 0 {
return multierr.Combine(errs...)
}
s.log.Debug("stopped inbounds")
return nil
} | |
c11015 | wait.Submit(o.Oneway.Stop)
}
if o.Stream != nil {
wait.Submit(o.Stream.Stop)
}
}
if errs := wait.Wait(); len(errs) > 0 {
return multierr.Combine(errs...)
}
s.log.Debug("stopped outbounds")
return nil
} | |
c11016 |
s.log.Debug("stopping transports")
wait := errorsync.ErrorWaiter{}
for _, t := range s.dispatcher.transports {
wait.Submit(t.Stop)
}
if errs := wait.Wait(); len(errs) > 0 {
return multierr.Combine(errs...)
}
s.log.Debug("stopped transports")
s.log.Debug("stopping metrics push loop, if any")
s.dispatcher.... | |
c11017 | {
return func(i *Inbound) {
i.mux = mux
i.muxPattern = pattern
}
} | |
c11018 | return func(i *Inbound) {
i.interceptor = interceptor
}
} | |
c11019 | *Inbound) {
i.shutdownTimeout = timeout
}
} | |
c11020 | t,
grabHeaders: make(map[string]struct{}),
bothResponseError: true,
}
for _, opt := range opts {
opt(i)
}
return i
} | |
c11021 | *Inbound {
i.tracer = tracer
return i
} | |
c11022 | i.shutdownTimeout)
defer cancel()
return i.shutdown(ctx)
} | |
c11023 |
return nil
}
return i.server.Shutdown(ctx)
})
} | |
c11024 | listener == nil {
return nil
}
return listener.Addr()
} | |
c11025 | ph.peers[j] = ph.peers[j], ph.peers[i]
p1.index = j
p2.index = i
} | |
c11026 | len(ph.peers)
ph.peers = append(ph.peers, ps)
} | |
c11027 | - 1
last := ph.peers[lastIndex]
ph.peers = ph.peers[:lastIndex]
return last
} | |
c11028 | different
// element so update the heap.
if index < ph.Len() {
ph.update(index)
}
// Set the index to negative so we do not try to delete it again.
ps.index = -1
} | |
c11029 | 1)
if random < len(ph.peers) {
randPeer := ph.peers[random]
ps.last, randPeer.last = randPeer.last, ps.last
heap.Fix(ph, random)
}
heap.Push(ph, ps)
} | |
c11030 | error {
log.Println("received message:", snk.Message)
return nil
} | |
c11031 | if c, ok := m.(unaryChain); ok {
unchained = append(unchained, c...)
continue
}
unchained = append(unchained, m)
}
switch len(unchained) {
case 0:
return middleware.NopUnaryInbound
case 1:
return unchained[0]
default:
return unaryChain(unchained)
}
} | |
c11032 | len(unchained) {
case 0:
return middleware.NopOnewayInbound
case 1:
return unchained[0]
default:
return onewayChain(unchained)
}
} | |
c11033 | len(unchained) {
case 0:
return middleware.NopStreamInbound
case 1:
return unchained[0]
default:
return streamChain(unchained)
}
} | |
c11034 | newThriftHandlerFunc(thriftTest, pfactory, pfactory))
mux.HandleFunc("/thrift/SecondService", newThriftHandlerFunc(secondService, pfactory, pfactory))
mux.HandleFunc("/thrift/multiplexed", newThriftHandlerFunc(multiplexed, pfactory, pfactory))
server = net.NewHTTPServer(&http.Server{
Addr: addr,
Handle... | |
c11035 | request.RoutingKey),
addToMetadata(md, RoutingDelegateHeader, request.RoutingDelegate),
addToMetadata(md, EncodingHeader, string(request.Encoding)),
); err != nil {
return md, err
}
return md, addApplicationHeaders(md, request.Headers)
} | |
c11036 | case CallerHeader:
request.Caller = value
case ServiceHeader:
request.Service = value
case ShardKeyHeader:
request.ShardKey = value
case RoutingKeyHeader:
request.RoutingKey = value
case RoutingDelegateHeader:
request.RoutingDelegate = value
case EncodingHeader:
request.Encoding = transport... | |
c11037 | yarpcerrors.InvalidArgumentErrorf("cannot use reserved header in application headers: %s", header)
}
if err := addToMetadata(md, header, value); err != nil {
return err
}
}
return nil
} | |
c11038 | value = values[0]
default:
return headers, yarpcerrors.InvalidArgumentErrorf("header has more than one value: %s", header)
}
headers = headers.With(header, value)
}
return headers, nil
} | |
c11039 | {
return yarpcerrors.InvalidArgumentErrorf("duplicate key: %s", key)
}
md[key] = []string{value}
return nil
} | |
c11040 |
switch contentType[len(baseContentType)] {
case '+', ';':
return contentType[len(baseContentType)+1:]
default:
return ""
}
} | |
c11041 | := handler(key, value); err != nil {
return err
}
}
}
return nil
} | |
c11042 | = strings.ToLower(key)
md[key] = []string{value}
} | |
c11043 | = append(opts, mapdecode.TagName(_tagName))
return mapdecode.Decode(dst, src, opts...)
} | |
c11044 | the case where data is an
// interface{} holding a string.
v, ok := srcData.Interface().(string)
if !ok {
// Cannot interpolate non-string type. This shouldn't be an error
// because an integer field may be marked as interpolatable and may
// have received an integer as expected.
return srcData, nil
... | |
c11045 | += int(num)
// Check data length
if len(b) >= n {
return b[n-int(num) : n], false, n, nil
}
return nil, false, n, io.EOF
} | |
c11046 | uint64(b[1]) | uint64(b[2])<<8 | uint64(b[3])<<16 |
uint64(b[4])<<24 | uint64(b[5])<<32 | uint64(b[6])<<40 |
uint64(b[7])<<48 | uint64(b[8])<<56,
false, 9
}
// 0-250: value of first byte
return uint64(b[0]), false, 1
} | |
c11047 | NewError(ErrorNetwork, errors.New("ldap: could not retrieve response"))
}
return pr.Packet, pr.Error
} | |
c11048 | return nil, NewError(ErrorNetwork, err)
}
conn := NewConn(c, false)
conn.Start()
return conn, nil
} | |
c11049 |
// Handshake error, close the established connection before we return an error
dc.Close()
return nil, NewError(ErrorNetwork, err)
}
conn := NewConn(c, true)
conn.Start()
return conn, nil
} | |
c11050 | l.processMessages()
l.wgClose.Add(1)
} | |
c11051 | l.requestTimeout = timeout
}
} | |
c11052 | nil {
if messageID, ok := <-l.chanMessageID; ok {
return messageID
}
}
return 0
} | |
c11053 | l.Debug {
if err := addLDAPDescriptions(packet); err != nil {
l.Close()
return err
}
ber.PrintPacket(packet)
}
if resultCode, message := getLDAPResultCode(packet); resultCode == LDAPResultSuccess {
conn := tls.Client(l.conn, config)
if err := conn.Handshake(); err != nil {
l.Close()
return Ne... | |
c11054 | Cannot get TLS Connection State for non-TLS connection")
}
state := l.conn.(*tls.Conn).ConnectionState()
return &state, nil
} | |
c11055 |
for i, s := 0, b; i < n; i++ {
o := copy(s, `,"\\x`)
o += hex.Encode(s[o:], a[i])
s[o] = '"'
s = s[o+1:]
}
b[0] = '{'
b[size-1] = '}'
return string(b), nil
}
return "{}", nil
} | |
c11056 | != nil {
return b, del, err
}
for i := 1; i < n; i++ {
b = append(b, del...)
if b, del, err = appendArrayElement(b, rv.Index(i)); err != nil {
return b, del, err
}
}
return append(b, '}'), del, nil
} | |
c11057 | append(a.Attributes, Attribute{Type: attrType, Vals: attrVals})
} | |
c11058 |
dst[8], dst[13], dst[18], dst[23] = '-', '-', '-', '-'
hex.Encode(dst[0:], src[0:4])
hex.Encode(dst[9:], src[4:6])
hex.Encode(dst[14:], src[6:8])
hex.Encode(dst[19:], src[8:10])
hex.Encode(dst[24:], src[10:16])
return dst, nil
} | |
c11059 |
var encodedAttributes []*EntryAttribute
for _, attributeName := range attributeNames {
encodedAttributes = append(encodedAttributes, NewEntryAttribute(attributeName, attributes[attributeName]))
}
return &Entry{
DN: dn,
Attributes: encodedAttributes,
}
} | |
c11060 | attribute {
return attr.Values
}
}
return []string{}
} | |
c11061 | == attribute {
return attr.ByteValues
}
}
return [][]byte{}
} | |
c11062 | len(values) == 0 {
return ""
}
return values[0]
} | |
c11063 | len(values) == 0 {
return []byte{}
}
return values[0]
} | |
c11064 | e.DN)
for _, attr := range e.Attributes {
attr.Print()
}
} | |
c11065 | ", indent), e.DN)
for _, attr := range e.Attributes {
attr.PrettyPrint(indent + 2)
}
} | |
c11066 | []byte(value))
}
return &EntryAttribute{
Name: name,
Values: values,
ByteValues: bytes,
}
} | |
c11067 |
TimeLimit: TimeLimit,
TypesOnly: TypesOnly,
Filter: Filter,
Attributes: Attributes,
Controls: Controls,
}
} | |
c11068 |
return err.Column
case 'd':
return err.DataTypeName
case 'n':
return err.Constraint
case 'F':
return err.File
case 'L':
return err.Line
case 'R':
return err.Routine
}
return ""
} | |
c11069 | strings.EqualFold(a.Type, other.Type) && a.Value == other.Value
} | |
c11070 | }
ber.PrintPacket(packet)
}
if packet.Children[1].Tag == ApplicationExtendedResponse {
resultCode, resultDescription := getLDAPResultCode(packet)
if resultCode != 0 {
return nil, NewError(resultCode, errors.New(resultDescription))
}
} else {
return nil, NewError(ErrorUnexpectedResponse, fmt.Errorf("Un... | |
c11071 | := json.Marshal(out)
if err != nil {
panic(err)
}
return raw
} | |
c11072 | 8 /* Need some margin for tab */
return displayCert(c, verbose)
} | |
c11073 | {
return c.SprintfFunc()(t.Format("2006-01-02 15:04 MST"))
} | |
c11074 |
} else if now.After(start) {
return timeString(start, yellow)
} else {
return timeString(start, red)
}
} | |
c11075 |
} else if now.Before(end) {
return timeString(end, yellow)
} else {
return timeString(end, red)
}
} | |
c11076 | != "" {
return fmt.Sprintf("CN=%s", name.CommonName)
}
return PrintShortName(name)
} | |
c11077 | out += ", "
}
out += fmt.Sprintf("%s=%v", short, name.Value)
printed = true
}
}
return
} | |
c11078 | = boolSetting("disable_prepared_binary_result", &c.disablePreparedBinaryResult)
if err != nil {
return err
}
err = boolSetting("binary_parameters", &c.binaryParameters)
if err != nil {
return err
}
return nil
} | |
c11079 |
}
}
if allBinary {
return colFmts, colFmtDataAllBinary
} else if allText {
return colFmts, colFmtDataAllText
} else {
colFmtData = make([]byte, 2+len(colFmts)*2)
binary.BigEndian.PutUint16(colFmtData, uint16(len(colFmts)))
for i, v := range colFmts {
binary.BigEndian.PutUint16(colFmtData[2+i*2:], u... | |
c11080 | {
return cn.query(query, args)
} | |
c11081 | = cn.c.Write([]byte{typ, '\x00', '\x00', '\x00', '\x04'})
return err
} | |
c11082 | x[0]
n := int(binary.BigEndian.Uint32(x[1:])) - 4
var y []byte
if n <= len(cn.scratch) {
y = cn.scratch[:n]
} else {
y = make([]byte, n)
}
_, err = io.ReadFull(cn.buf, y)
if err != nil {
return 0, err
}
*r = y
return t, nil
} | |
c11083 | t {
case 'E':
panic(parseError(r))
case 'N':
// ignore
default:
return
}
}
} | |
c11084 | 'N':
// ignore
case 'S':
cn.processParameterStatus(r)
default:
return t
}
}
} | |
c11085 | {
r = &readBuf{}
t = cn.recv1Buf(r)
return t, r
} | |
c11086 |
case "disable_prepared_binary_result":
return true
case "binary_parameters":
return true
default:
return false
}
} | |
c11087 | "UTF-8", like Postgres does
s := strings.Map(alnumLowerASCII, name)
return s == "utf8" || s == "unicode"
} | |
c11088 | PartialAttribute{Type: attrType, Vals: attrVals})
} | |
c11089 | PartialAttribute{Type: attrType, Vals: attrVals})
} | |
c11090 | PartialAttribute{Type: attrType, Vals: attrVals})
} | |
c11091 | := <-msgCtx.responses
if !ok {
return NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
}
packet, err = packetResponse.ReadPacket()
l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
if err != nil {
return err
}
if l.Debug {
if err := addLDAPDescriptions(packet); err != nil {
r... | |
c11092 | if err != nil {
return false, err
}
if l.Debug {
if err := addLDAPDescriptions(packet); err != nil {
return false, err
}
ber.PrintPacket(packet)
}
if packet.Children[1].Tag == ApplicationCompareResponse {
resultCode, resultDescription := getLDAPResultCode(packet)
if resultCode == LDAPResultCompare... | |
c11093 | return newDialListenerConn(defaultDialer{}, name, notificationChan)
} | |
c11094 |
l.connectionLock.Unlock()
if err != nil {
l.senderLock.Unlock()
return err
}
return nil
} | |
c11095 | expectedState = connStateIdle
case connStateExpectReadyForQuery:
expectedState = connStateExpectResponse
default:
panic(fmt.Sprintf("unexpected listenerConnState %d", newState))
}
return atomic.CompareAndSwapInt32(&l.connState, expectedState, newState)
} | |
c11096 | other one will probably get
// net.errClosed), so that goroutine sets the error we expose while the
// other error is discarded. If the connection is lost while two
// goroutines are operating on the socket, it probably doesn't matter which
// error we expose so we don't try to do anything more complex.
l.connec... | |
c11097 | l.ExecSimpleQuery("LISTEN " + QuoteIdentifier(channel))
} | |
c11098 | if !sent {
return err
}
if err != nil {
// shouldn't happen
panic(err)
}
return nil
} | |
c11099 | eventCallback,
channels: make(map[string]struct{}),
Notify: make(chan *Notification, 32),
}
l.reconnectCond = sync.NewCond(&l.lock)
go l.listenerMain()
return l
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.