mirror of
https://github.com/hashicorp/packer.git
synced 2026-05-28 04:35:38 -04:00
Configure MessagePack to be a bit more like gob
By default codec's MessagePack encode/decode will convert a string into a []byte. Tweak the settings so that string -> string and []byte -> []byte.
This commit is contained in:
parent
2c0a7a501e
commit
ee6a118090
2 changed files with 10 additions and 4 deletions
|
|
@ -40,8 +40,11 @@ func newClientWithMux(mux *muxBroker, streamId uint32) (*Client, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
var h codec.MsgpackHandle
|
||||
clientCodec := codec.GoRpc.ClientCodec(clientConn, &h)
|
||||
h := &codec.MsgpackHandle{
|
||||
RawToString: true,
|
||||
WriteExt: true,
|
||||
}
|
||||
clientCodec := codec.GoRpc.ClientCodec(clientConn, h)
|
||||
|
||||
return &Client{
|
||||
mux: mux,
|
||||
|
|
|
|||
|
|
@ -148,8 +148,11 @@ func (s *Server) Serve() {
|
|||
}
|
||||
defer stream.Close()
|
||||
|
||||
var h codec.MsgpackHandle
|
||||
rpcCodec := codec.GoRpc.ServerCodec(stream, &h)
|
||||
h := &codec.MsgpackHandle{
|
||||
RawToString: true,
|
||||
WriteExt: true,
|
||||
}
|
||||
rpcCodec := codec.GoRpc.ServerCodec(stream, h)
|
||||
s.server.ServeCodec(rpcCodec)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue