MCPcopy Index your code
hub / github.com/CodisLabs/codis / handleRequestPing

Method handleRequestPing

pkg/proxy/session.go:349–366  ·  view source on GitHub ↗
(r *Request, d *Router)

Source from the content-addressed store, hash-verified

347}
348
349func (s *Session) handleRequestPing(r *Request, d *Router) error {
350 var addr string
351 var nblks = len(r.Multi) - 1
352 switch {
353 case nblks == 0:
354 slot := uint32(time.Now().Nanosecond()) % MaxSlotNum
355 return d.dispatchSlot(r, int(slot))
356 default:
357 addr = string(r.Multi[1].Value)
358 copy(r.Multi[1:], r.Multi[2:])
359 r.Multi = r.Multi[:nblks]
360 }
361 if !d.dispatchAddr(r, addr) {
362 r.Resp = redis.NewErrorf("ERR backend server '%s' not found", addr)
363 return nil
364 }
365 return nil
366}
367
368func (s *Session) handleRequestInfo(r *Request, d *Router) error {
369 var addr string

Callers 1

handleRequestMethod · 0.95

Calls 2

dispatchSlotMethod · 0.80
dispatchAddrMethod · 0.80

Tested by

no test coverage detected