func (c *serverCodec) ReadRequestHeader(r *rpc.Request) (err os.Error) { c.req.header.Reset() lbuf := make([]byte, lenSize) _, err = io.ReadFull(c.c, lbuf) if err != nil { return } pbuf := make([]byte, decodeLen(lbuf)) _, err = io.ReadFull(c.c, pbuf) if err != nil { return } c.req.header.SetBuf(pbuf) h := new(Header) err = c.req.header.Unmarshal(h) if err != nil { return } r.Seq = *h.Seq r.ServiceMethod = *h.ServiceMethod return }
func (qx *queryCodec) ReadRequestHeader(req *rpc.Request) os.Error { if qx.seq == 0 { return os.EOF } req.Seq = qx.seq req.ServiceMethod = pathToServiceMethod(qx.Req.URL.Path) return nil }
func (c *serverCodec) ReadRequestHeader(r *rpc.Request) os.Error { c.req.reset() if err := c.dec.Decode(&c.req); err != nil { return err } r.ServiceMethod = c.req.Method // JSON request id can be any JSON value; // RPC package expects uint64. Translate to // internal uint64 and save JSON on the side. c.mutex.Lock() c.seq++ c.pending[c.seq] = c.req.Id c.req.Id = nil r.Seq = c.seq c.mutex.Unlock() return nil }