mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-24 10:07:04 +02:00
Some nitpicking
This commit is contained in:
parent
7a870dfbb1
commit
c5a08d3159
@ -16,8 +16,11 @@ type MessageType int
|
||||
// Takes in a connection/buffer and returns a new Codec
|
||||
type NewCodec func(io.ReadWriteCloser) Codec
|
||||
|
||||
// Codec encodes/decodes various types of
|
||||
// messages used within go-micro
|
||||
// Codec encodes/decodes various types of messages used within go-micro.
|
||||
// ReadHeader and ReadBody are called in pairs to read requests/responses
|
||||
// from the connection. Close is called when finished with the
|
||||
// connection. ReadBody may be called with a nil argument to force the
|
||||
// body to be read and discarded.
|
||||
type Codec interface {
|
||||
ReadHeader(*Message, MessageType) error
|
||||
ReadBody(interface{}) error
|
||||
|
@ -71,7 +71,7 @@ func (s *rpcServer) accept(sock transport.Socket) {
|
||||
|
||||
ctx := c.WithMetadata(context.Background(), hdr)
|
||||
// TODO: needs better error handling
|
||||
if err := s.rpc.ServeRequestWithContext(ctx, codec); err != nil {
|
||||
if err := s.rpc.serveRequest(ctx, codec); err != nil {
|
||||
log.Errorf("Unexpected error serving request, closing socket: %v", err)
|
||||
sock.Close()
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ func (m *methodType) prepareContext(ctx context.Context) reflect.Value {
|
||||
return reflect.Zero(m.ContextType)
|
||||
}
|
||||
|
||||
func (server *server) ServeRequestWithContext(ctx context.Context, codec serverCodec) error {
|
||||
func (server *server) serveRequest(ctx context.Context, codec serverCodec) error {
|
||||
sending := new(sync.Mutex)
|
||||
service, mtype, req, argv, replyv, keepReading, err := server.readRequest(codec)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user