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