Commit 655906f5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bf824e6c
...@@ -1533,7 +1533,6 @@ func (c *Conn) Recv() (proto.Msg, error) { ...@@ -1533,7 +1533,6 @@ func (c *Conn) Recv() (proto.Msg, error) {
func (link *NodeLink) sendMsg(connId uint32, msg proto.Msg) error { func (link *NodeLink) sendMsg(connId uint32, msg proto.Msg) error {
traceMsgSendPre(link, connId, msg) traceMsgSendPre(link, connId, msg)
//buf := msgPack(connId, msg)
buf := pktEncode(link.enc, connId, msg) buf := pktEncode(link.enc, connId, msg)
return link.sendPkt(buf) // XXX more context in err? (msg type) return link.sendPkt(buf) // XXX more context in err? (msg type)
// FIXME ^^^ shutdown whole link on error // FIXME ^^^ shutdown whole link on error
...@@ -1543,7 +1542,6 @@ func (link *NodeLink) sendMsg(connId uint32, msg proto.Msg) error { ...@@ -1543,7 +1542,6 @@ func (link *NodeLink) sendMsg(connId uint32, msg proto.Msg) error {
func (c *Conn) Send(msg proto.Msg) error { func (c *Conn) Send(msg proto.Msg) error {
traceMsgSendPre(c.link, c.connId, msg) traceMsgSendPre(c.link, c.connId, msg)
//buf := msgPack(c.connId, msg)
buf := pktEncode(c.link.enc, c.connId, msg) buf := pktEncode(c.link.enc, c.connId, msg)
return c.sendPkt(buf) // XXX more context in err? (msg type) return c.sendPkt(buf) // XXX more context in err? (msg type)
} }
......
...@@ -51,7 +51,7 @@ type T struct { ...@@ -51,7 +51,7 @@ type T struct {
enc proto.Encoding // encoding to use for messages exchange enc proto.Encoding // encoding to use for messages exchange
} }
// bin returns payload for raw binary data as would-be encoded by t.enc . // bin returns payload for raw binary data as it would-be encoded by t.enc .
// XXX place // XXX place
func (t *T) bin(data string) []byte { func (t *T) bin(data string) []byte {
switch t.enc { switch t.enc {
...@@ -149,10 +149,7 @@ func _mkpkt(enc proto.Encoding, connid uint32, msgcode uint16, payload []byte) * ...@@ -149,10 +149,7 @@ func _mkpkt(enc proto.Encoding, connid uint32, msgcode uint16, payload []byte) *
b = msgp.AppendArrayHeader (b, 3) b = msgp.AppendArrayHeader (b, 3)
b = msgp.AppendUint32 (b, connid) b = msgp.AppendUint32 (b, connid)
b = msgp.AppendUint16 (b, msgcode) b = msgp.AppendUint16 (b, msgcode)
// // NOTE payload is appended wrapped into bin object. We need // NOTE payload is assumed to be valid msgpack-encoded object.
// // this not to break framing, because in M-encoding whole
// // packet must be a valid msgpack object.
// b = msgp.AppendBytes (b, payload)
b = append (b, payload...) b = append (b, payload...)
return &pktBuf{b} return &pktBuf{b}
...@@ -180,11 +177,6 @@ func (t *T) xverifyPkt(pkt *pktBuf, connid uint32, msgcode uint16, payload []byt ...@@ -180,11 +177,6 @@ func (t *T) xverifyPkt(pkt *pktBuf, connid uint32, msgcode uint16, payload []byt
if pktMsgCode != msgcode { if pktMsgCode != msgcode {
errv.Appendf("header: unexpected msgcode %v (want %v)", pktMsgCode, msgcode) errv.Appendf("header: unexpected msgcode %v (want %v)", pktMsgCode, msgcode)
} }
// // M-encoding -> wrap payloadOK into bin (see _mkpkt ^^^ for why)
// if t.enc == 'M' {
// payload = msgp.AppendBytes(nil, payload)
// }
if !bytes.Equal(pktPayload, payload) { if !bytes.Equal(pktPayload, payload) {
errv.Appendf("payload differ:\n%s", errv.Appendf("payload differ:\n%s",
pretty.Compare(string(payload), string(pktPayload))) pretty.Compare(string(payload), string(pktPayload)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment