NewXXXServer doesnt run Start or return error

This commit is contained in:
Ethan Buchman
2017-05-15 12:51:24 -04:00
parent 21fff49f2c
commit d07b2352ad
9 changed files with 35 additions and 25 deletions
+2 -3
View File
@@ -22,7 +22,7 @@ type GRPCServer struct {
}
// NewGRPCServer returns a new gRPC ABCI server
func NewGRPCServer(protoAddr string, app types.ABCIApplicationServer) (cmn.Service, error) {
func NewGRPCServer(protoAddr string, app types.ABCIApplicationServer) cmn.Service {
parts := strings.SplitN(protoAddr, "://", 2)
proto, addr := parts[0], parts[1]
s := &GRPCServer{
@@ -32,8 +32,7 @@ func NewGRPCServer(protoAddr string, app types.ABCIApplicationServer) (cmn.Servi
app: app,
}
s.BaseService = *cmn.NewBaseService(nil, "ABCIServer", s)
_, err := s.Start() // Just start it
return s, err
return s
}
// OnStart starts the gRPC service
+2 -2
View File
@@ -21,9 +21,9 @@ func NewServer(protoAddr, transport string, app types.Application) (cmn.Service,
var err error
switch transport {
case "socket":
s, err = NewSocketServer(protoAddr, app)
s = NewSocketServer(protoAddr, app)
case "grpc":
s, err = NewGRPCServer(protoAddr, types.NewGRPCApplication(app))
s = NewGRPCServer(protoAddr, types.NewGRPCApplication(app))
default:
err = fmt.Errorf("Unknown server type %s", transport)
}
+2 -5
View File
@@ -29,7 +29,7 @@ type SocketServer struct {
app types.Application
}
func NewSocketServer(protoAddr string, app types.Application) (cmn.Service, error) {
func NewSocketServer(protoAddr string, app types.Application) cmn.Service {
parts := strings.SplitN(protoAddr, "://", 2)
proto, addr := parts[0], parts[1]
s := &SocketServer{
@@ -40,10 +40,7 @@ func NewSocketServer(protoAddr string, app types.Application) (cmn.Service, erro
conns: make(map[int]net.Conn),
}
s.BaseService = *cmn.NewBaseService(nil, "ABCIServer", s)
// FIXME we are loosing "Starting ABCIServer" message here
// add logger to params?
_, err := s.Start() // Just start it
return s, err
return s
}
func (s *SocketServer) OnStart() error {