Skip to content

Commit 96e8ee2

Browse files
committed
Fix misnomer for variable port
1 parent d9eca8e commit 96e8ee2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

main.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import (
1616
"time"
1717

1818
log "github.com/Sirupsen/logrus"
19-
"github.com/itsjamie/gin-cors"
2019
"github.com/carlescere/scheduler"
2120
"github.com/gin-gonic/gin"
21+
"github.com/itsjamie/gin-cors"
2222
"github.com/kardianos/osext"
2323
"github.com/vharitonsky/iniflags"
2424
//"github.com/sanbornm/go-selfupdate/selfupdate" #included in update.go to change heavily
@@ -232,21 +232,21 @@ func main() {
232232

233233
socketHandler := wsHandler().ServeHTTP
234234

235-
portPlain, err := getBindPort(8990, 9001)
235+
port, err := getBindPort(8990, 9001)
236236
if err != nil {
237237
panic(err)
238238
}
239-
// All the ports p in the range 8990 <= p <= portPlain
239+
// All the ports p in the range 8990 <= p <= port
240240
// has already been scanned and results not free.
241241
// Thus we can restrict the search range for portSSL
242-
// to [portPlain+1, 9001).
243-
portSSL, err := getBindPort(portPlain+1, 9001)
242+
// to [port+1, 9001).
243+
portSSL, err := getBindPort(port+1, 9001)
244244
if err != nil {
245245
panic(err)
246246
}
247247

248248
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"
249-
extraOriginStr += ", http://localhost:" + strconv.Itoa(portPlain) + ", https://localhost:" + strconv.Itoa(portPlain)
249+
extraOriginStr += ", http://localhost:" + strconv.Itoa(port) + ", https://localhost:" + strconv.Itoa(port)
250250
extraOriginStr += ", http://localhost:" + strconv.Itoa(portSSL) + ", https://localhost:" + strconv.Itoa(portSSL)
251251

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

287287
go func() {
288288

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

0 commit comments

Comments
 (0)