38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
package server
|
|
|
|
import (
|
|
"git.loafle.net/commons_go/rpc"
|
|
crcs "git.loafle.net/commons_go/rpc/connection/socket"
|
|
"git.loafle.net/commons_go/rpc/protocol"
|
|
"git.loafle.net/commons_go/rpc/server"
|
|
)
|
|
|
|
func newRPCServletHandler(rpcRegistry rpc.Registry) server.ServletHandler {
|
|
sh := &RPCServletHandlers{}
|
|
sh.RPCRegistry = rpcRegistry
|
|
|
|
return sh
|
|
}
|
|
|
|
type RPCServletHandlers struct {
|
|
server.ServletHandlers
|
|
rpcIO crcs.ServletHandlers
|
|
}
|
|
|
|
func (sh *RPCServletHandlers) ReadRequest(servletCTX rpc.ServletContext, codec protocol.ServerCodec, conn interface{}) (protocol.ServerRequestCodec, error) {
|
|
return sh.rpcIO.ReadRequest(servletCTX, codec, conn)
|
|
}
|
|
|
|
func (sh *RPCServletHandlers) WriteResponse(servletCTX rpc.ServletContext, conn interface{}, requestCodec protocol.ServerRequestCodec, result interface{}, err error) error {
|
|
return sh.rpcIO.WriteResponse(servletCTX, conn, requestCodec, result, err)
|
|
}
|
|
|
|
func (sh *RPCServletHandlers) WriteNotification(servletCTX rpc.ServletContext, conn interface{}, codec protocol.ServerCodec, method string, args []interface{}) error {
|
|
return sh.rpcIO.WriteNotification(servletCTX, conn, codec, method, args)
|
|
}
|
|
|
|
func (sh *RPCServletHandlers) Validate() {
|
|
sh.ServletHandlers.Validate()
|
|
|
|
}
|