You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
710 B

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. /*
  2. Package server is used to start a new ABCI server.
  3. It contains two server implementation:
  4. * gRPC server
  5. * socket server
  6. */
  7. package server
  8. import (
  9. "fmt"
  10. "github.com/tendermint/tendermint/abci/types"
  11. "github.com/tendermint/tendermint/libs/log"
  12. "github.com/tendermint/tendermint/libs/service"
  13. )
  14. func NewServer(logger log.Logger, protoAddr, transport string, app types.Application) (service.Service, error) {
  15. var s service.Service
  16. var err error
  17. switch transport {
  18. case "socket":
  19. s = NewSocketServer(logger, protoAddr, app)
  20. case "grpc":
  21. s = NewGRPCServer(logger, protoAddr, types.NewGRPCApplication(app))
  22. default:
  23. err = fmt.Errorf("unknown server type %s", transport)
  24. }
  25. return s, err
  26. }