diff options
Diffstat (limited to 'cmd/web/main.go')
| -rw-r--r-- | cmd/web/main.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cmd/web/main.go b/cmd/web/main.go index 45b64ae..da0bebd 100644 --- a/cmd/web/main.go +++ b/cmd/web/main.go @@ -5,10 +5,10 @@ import ( "flag" "fmt" "log" - "math/rand" "net/http" "os" - "time" + "strconv" + "strings" "github.com/gorilla/mux" ) @@ -66,8 +66,16 @@ func main() { err = s.ListenAndServe() if err != nil { Logger.Printf("Encountered: %s", err) - rand.Seed(time.Now().UnixNano()) - Listen = fmt.Sprintf(":%d", rand.Intn(9000)+1024) + + parts := strings.Split(Listen, ":") + port, err := strconv.Atoi(parts[1]) + if err != nil { + panic(err) + } + port += 1 + + Listen = fmt.Sprintf("%s:%d", parts[0], port) + Logger.Printf("Trying: %s", Listen) s.Addr = Listen } |
