Commit ee6a1180 authored by Julian Phillips's avatar Julian Phillips

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.
parent 2c0a7a50
...@@ -40,8 +40,11 @@ func newClientWithMux(mux *muxBroker, streamId uint32) (*Client, error) { ...@@ -40,8 +40,11 @@ func newClientWithMux(mux *muxBroker, streamId uint32) (*Client, error) {
return nil, err return nil, err
} }
var h codec.MsgpackHandle h := &codec.MsgpackHandle{
clientCodec := codec.GoRpc.ClientCodec(clientConn, &h) RawToString: true,
WriteExt: true,
}
clientCodec := codec.GoRpc.ClientCodec(clientConn, h)
return &Client{ return &Client{
mux: mux, mux: mux,
......
...@@ -148,8 +148,11 @@ func (s *Server) Serve() { ...@@ -148,8 +148,11 @@ func (s *Server) Serve() {
} }
defer stream.Close() defer stream.Close()
var h codec.MsgpackHandle h := &codec.MsgpackHandle{
rpcCodec := codec.GoRpc.ServerCodec(stream, &h) RawToString: true,
WriteExt: true,
}
rpcCodec := codec.GoRpc.ServerCodec(stream, h)
s.server.ServeCodec(rpcCodec) s.server.ServeCodec(rpcCodec)
} }
......
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