This commit is contained in:
crusader 2018-07-01 01:39:08 +09:00
parent 32883be22b
commit f5810183da

View File

@ -202,11 +202,12 @@ func (c *Client) handleClient(readChan <-chan css.SocketMessage, writeChan chan<
func (c *Client) handleSend(stopChan <-chan struct{}, doneChan chan<- error, writeChan chan<- css.SocketMessage) {
var (
rs *requestState
id interface{}
message []byte
err error
ok bool
rs *requestState
id interface{}
messageType int
message []byte
err error
ok bool
)
defer func() {
@ -233,7 +234,7 @@ LOOP:
if 0 < rs.id {
id = rs.id
}
message, err = c.ClientHandler.GetRPCCodec().NewRequest(rs.method, rs.params, id)
messageType, message, err = c.ClientHandler.GetRPCCodec().NewRequest(rs.method, rs.params, id)
if nil != err {
rs.setError(err)
rs.done()
@ -241,7 +242,7 @@ LOOP:
}
select {
case writeChan <- css.MakeSocketMessage(css.TextMessage, message):
case writeChan <- css.MakeSocketMessage(messageType, message):
default:
rs.setError(fmt.Errorf("%s cannot send request", c.logHeader()))
rs.done()