This commit is contained in:
crusader 2018-03-22 20:51:20 +09:00
parent fccf18a26a
commit e3a873a067
2 changed files with 15 additions and 12 deletions

View File

@ -57,6 +57,10 @@ func (srwch *ServletReadWriteCloseHandlers) WriteNotification(servletCTX rpc.Ser
return wErr return wErr
} }
defer func() {
wc.Close()
}()
if wErr := codec.WriteNotification(wc, method, params); nil != wErr { if wErr := codec.WriteNotification(wc, method, params); nil != wErr {
return wErr return wErr
} }

View File

@ -1,8 +1,6 @@
package server package server
import ( import (
"fmt"
"git.loafle.net/commons_go/logging" "git.loafle.net/commons_go/logging"
"git.loafle.net/commons_go/rpc" "git.loafle.net/commons_go/rpc"
"git.loafle.net/commons_go/rpc/protocol" "git.loafle.net/commons_go/rpc/protocol"
@ -16,18 +14,19 @@ type ServletHandlers struct {
} }
func (sh *ServletHandlers) Invoke(servletCTX rpc.ServletContext, requestCodec protocol.RegistryCodec) (result interface{}, err error) { func (sh *ServletHandlers) Invoke(servletCTX rpc.ServletContext, requestCodec protocol.RegistryCodec) (result interface{}, err error) {
if !sh.RPCInvoker.HasMethod(requestCodec.Method()) { // if !sh.RPCInvoker.HasMethod(requestCodec.Method()) {
return nil, fmt.Errorf("RPC Servlet Handler: Method[%s] is not exist", requestCodec.Method()) // return nil, fmt.Errorf("RPC Servlet Handler: Method[%s] is not exist", requestCodec.Method())
} // }
result, err = sh.RPCInvoker.Invoke(requestCodec) result, err = sh.RPCInvoker.Invoke(requestCodec)
if nil != err {
if params, pErr := requestCodec.Params(); nil != err { // if nil != err {
logging.Logger().Errorf("RPC Servlet Handler: Read Param of Method[%s] returns error %v", requestCodec.Method(), pErr) // params, pErr := requestCodec.Params()
} else { // if nil != pErr {
logging.Logger().Errorf("RPC Servlet Handler: Method[%s] params[%v] returns error %v", requestCodec.Method(), params, err) // logging.Logger().Errorf("RPC Servlet Handler: Read Param of Method[%s] returns error %v", requestCodec.Method(), pErr)
} // }
} // logging.Logger().Errorf("RPC Servlet Handler: Method[%s] params[%v] returns error %v", requestCodec.Method(), params, err)
// }
return return
} }