summaryrefslogtreecommitdiffhomepage
path: root/api/grpc_server.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/grpc_server.go')
-rw-r--r--api/grpc_server.go25
1 files changed, 12 insertions, 13 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go
index a359f761..21b9d260 100644
--- a/api/grpc_server.go
+++ b/api/grpc_server.go
@@ -64,25 +64,24 @@ func (s *Server) Serve() error {
wg.Add(len(l))
serve := func(host string) {
- for {
- defer wg.Done()
- lis, err := net.Listen("tcp", fmt.Sprintf(host))
- if err != nil {
- log.WithFields(log.Fields{
- "Topic": "grpc",
- "Key": host,
- "Error": err,
- }).Warn("listen failed")
- return
- }
- err = s.grpcServer.Serve(lis)
+ defer wg.Done()
+ lis, err := net.Listen("tcp", fmt.Sprintf(host))
+ if err != nil {
log.WithFields(log.Fields{
"Topic": "grpc",
"Key": host,
"Error": err,
- }).Warn("accept failed")
+ }).Warn("listen failed")
+ return
}
+ err = s.grpcServer.Serve(lis)
+ log.WithFields(log.Fields{
+ "Topic": "grpc",
+ "Key": host,
+ "Error": err,
+ }).Warn("accept failed")
}
+
for _, host := range l {
go serve(host)
}