mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
avoid fatal error if port is already in use
This commit is contained in:
parent
f7366a9668
commit
ef6c6c450e
|
@ -1,6 +1,7 @@
|
||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -112,7 +113,8 @@ func NewIpAndLocalListeners(host string, port int, timeout time.Duration) (ipLis
|
||||||
if host != "localhost" && host != "" && host != "0.0.0.0" && host != "127.0.0.1" && host != "[::]" && host != "[::1]" {
|
if host != "localhost" && host != "" && host != "0.0.0.0" && host != "127.0.0.1" && host != "[::]" && host != "[::1]" {
|
||||||
listner, err = net.Listen("tcp", JoinHostPort("localhost", port))
|
listner, err = net.Listen("tcp", JoinHostPort("localhost", port))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
glog.V(0).Infof("skip starting on %s:%d: %v", host, port, err)
|
||||||
|
return ipListner, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
localListener = &Listener{
|
localListener = &Listener{
|
||||||
|
|
Loading…
Reference in a new issue