Skip to content

Fix misnomer for variable port #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"time"

log "github.com/Sirupsen/logrus"
"github.com/itsjamie/gin-cors"
"github.com/carlescere/scheduler"
"github.com/gin-gonic/gin"
"github.com/itsjamie/gin-cors"
"github.com/kardianos/osext"
"github.com/vharitonsky/iniflags"
//"github.com/sanbornm/go-selfupdate/selfupdate" #included in update.go to change heavily
Expand Down Expand Up @@ -232,21 +232,21 @@ func main() {

socketHandler := wsHandler().ServeHTTP

portPlain, err := getBindPort(8990, 9001)
port, err := getBindPort(8990, 9001)
if err != nil {
panic(err)
}
// All the ports p in the range 8990 <= p <= portPlain
// All the ports p in the range 8990 <= p <= port
// has already been scanned and results not free.
// Thus we can restrict the search range for portSSL
// to [portPlain+1, 9001).
portSSL, err := getBindPort(portPlain+1, 9001)
// to [port+1, 9001).
portSSL, err := getBindPort(port+1, 9001)
if err != nil {
panic(err)
}

extraOriginStr := "https://create.arduino.cc, http://create.arduino.cc, https://create-dev.arduino.cc, http://create-dev.arduino.cc, http://create-staging.arduino.cc, https://create-staging.arduino.cc"
extraOriginStr += ", http://localhost:" + strconv.Itoa(portPlain) + ", https://localhost:" + strconv.Itoa(portPlain)
extraOriginStr += ", http://localhost:" + strconv.Itoa(port) + ", https://localhost:" + strconv.Itoa(port)
extraOriginStr += ", http://localhost:" + strconv.Itoa(portSSL) + ", https://localhost:" + strconv.Itoa(portSSL)

r.Use(cors.Middleware(cors.Config{
Expand Down Expand Up @@ -280,18 +280,18 @@ func main() {
log.Printf("Error trying to bind to port: %v, so exiting...", err)
} else {
ip := "0.0.0.0"
log.Print("Starting server and websocket (SSL) on " + ip + "" + port)
log.Print("Starting server and websocket (SSL) on " + ip + "" + string(port))
}
}()

go func() {

portStr := ":" + strconv.Itoa(portPlain)
portStr := ":" + strconv.Itoa(port)
if err := r.Run(portStr); err != nil {
log.Printf("Error trying to bind to port: %v, so exiting...", err)
} else {
ip := "0.0.0.0"
log.Print("Starting server and websocket on " + ip + "" + port)
log.Print("Starting server and websocket on " + ip + "" + string(port))
}
}()

Expand Down