mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
add web port check on start
This commit is contained in:
@@ -2,6 +2,7 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
@@ -15,8 +16,18 @@ func Start(port string, roSets bool) {
|
|||||||
if port == "" {
|
if port == "" {
|
||||||
port = "8090"
|
port = "8090"
|
||||||
}
|
}
|
||||||
go cleanCache()
|
log.TLogln("Check web port", port)
|
||||||
web.Start(port)
|
l, err := net.Listen("tcp", ":"+port)
|
||||||
|
if l != nil {
|
||||||
|
l.Close()
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
log.TLogln("Port", port, "already in use! Abort")
|
||||||
|
os.Exit(1)
|
||||||
|
} else {
|
||||||
|
go cleanCache()
|
||||||
|
web.Start(port)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanCache() {
|
func cleanCache() {
|
||||||
|
|||||||
Reference in New Issue
Block a user