For the legacy

This commit is contained in:
Asim Aslam
2019-01-18 10:12:57 +00:00
parent 9ce9977d21
commit 2cd2258731
14 changed files with 99 additions and 21 deletions

View File

@@ -45,9 +45,9 @@ func newClientCodec(conn io.ReadWriteCloser) *clientCodec {
func (c *clientCodec) Write(m *codec.Message, b interface{}) error {
c.Lock()
c.pending[m.Id] = m.Endpoint
c.pending[m.Id] = m.Method
c.Unlock()
c.req.Method = m.Endpoint
c.req.Method = m.Method
c.req.Params[0] = b
c.req.ID = m.Id
return c.enc.Encode(&c.req)
@@ -66,7 +66,7 @@ func (c *clientCodec) ReadHeader(m *codec.Message) error {
}
c.Lock()
m.Endpoint = c.pending[c.resp.ID]
m.Method = c.pending[c.resp.ID]
delete(c.pending, c.resp.ID)
c.Unlock()

View File

@@ -53,7 +53,7 @@ func (c *serverCodec) ReadHeader(m *codec.Message) error {
if err := c.dec.Decode(&c.req); err != nil {
return err
}
m.Endpoint = c.req.Method
m.Method = c.req.Method
m.Id = fmt.Sprintf("%v", c.req.ID)
c.req.ID = nil
return nil