Merge pull request #1804 from LeoHChen/only_listen_to_tcp4

[net] only listen to tcp4 address
pull/1805/head
Leo Chen 5 years ago committed by GitHub
commit 10f5d62748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      api/client/service/server.go
  2. 2
      api/proto/message/server.go
  3. 2
      api/service/syncing/downloader/server.go

@ -43,7 +43,7 @@ func (s *Server) GetFreeToken(ctx context.Context, request *proto.GetFreeTokenRe
func (s *Server) Start(ip, port string) (*grpc.Server, error) { func (s *Server) Start(ip, port string) (*grpc.Server, error) {
// TODO(minhdoan): Currently not using ip. Fix it later. // TODO(minhdoan): Currently not using ip. Fix it later.
addr := net.JoinHostPort("", port) addr := net.JoinHostPort("", port)
lis, err := net.Listen("tcp", addr) lis, err := net.Listen("tcp4", addr)
if err != nil { if err != nil {
log.Fatalf("failed to listen: %v", err) log.Fatalf("failed to listen: %v", err)
} }

@ -81,7 +81,7 @@ func (s *Server) Process(ctx context.Context, message *Message) (*Response, erro
// Start starts the Server on given ip and port. // Start starts the Server on given ip and port.
func (s *Server) Start() (*grpc.Server, error) { func (s *Server) Start() (*grpc.Server, error) {
addr := net.JoinHostPort(IP, Port) addr := net.JoinHostPort(IP, Port)
lis, err := net.Listen("tcp", addr) lis, err := net.Listen("tcp4", addr)
if err != nil { if err != nil {
log.Fatalf("failed to listen: %v", err) log.Fatalf("failed to listen: %v", err)
} }

@ -43,7 +43,7 @@ func (s *Server) Query(ctx context.Context, request *pb.DownloaderRequest) (*pb.
// Start starts the Server on given ip and port. // Start starts the Server on given ip and port.
func (s *Server) Start(ip, port string) (*grpc.Server, error) { func (s *Server) Start(ip, port string) (*grpc.Server, error) {
addr := net.JoinHostPort("", port) addr := net.JoinHostPort("", port)
lis, err := net.Listen("tcp", addr) lis, err := net.Listen("tcp4", addr)
if err != nil { if err != nil {
log.Fatalf("[SYNC] failed to listen: %v", err) log.Fatalf("[SYNC] failed to listen: %v", err)
} }

Loading…
Cancel
Save