}
func (cc *ConnClient) reader() {
+ b := make([]byte, 0x800)
for {
- b := make([]byte, 0x800)
n, err := cc.conn.Read(b)
if err != nil {
// TODO: Do bad things to the dispatcher, and incoming calls to the client if we have a
transactions map[TransactionId]Transaction
}
+// The caller owns b.
func (me *Dispatcher) Dispatch(b []byte) error {
buf := bytes.NewBuffer(b)
var rh ResponseHeader
if t, ok := me.transactions[rh.TransactionId]; ok {
t.h(DispatchedResponse{
Header: rh,
- Body: buf.Bytes(),
+ Body: append([]byte(nil), buf.Bytes()...),
})
return nil
} else {