1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00

No need to set request in the buffer

This commit is contained in:
Asim Aslam 2019-08-16 14:42:45 +01:00
parent 5a5b1b8f6e
commit 991142cd57
2 changed files with 3 additions and 2 deletions

View File

@ -154,7 +154,7 @@ func setupProtocol(msg *transport.Message) codec.NewCodec {
func newRpcCodec(req *transport.Message, socket transport.Socket, c codec.NewCodec) codec.Codec {
rwc := &readWriteCloser{
rbuf: bytes.NewBuffer(req.Body),
rbuf: bytes.NewBuffer(nil),
wbuf: bytes.NewBuffer(nil),
}
r := &rpcCodec{

View File

@ -81,12 +81,13 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
return
}
// use Micro-Id as the stream identifier
// use Micro-Stream as the stream identifier
// in the event its blank we'll always process
// on the same socket
id := msg.Header["Micro-Stream"]
// if there's no stream id then its a standard request
// use the Micro-Id
if len(id) == 0 {
id = msg.Header["Micro-Id"]
}