mirror of
https://github.com/Evidlo/remarkable_printer.git
synced 2024-10-20 03:27:37 -04:00
re-arrange for better maintainability
This commit is contained in:
parent
71114492ed
commit
530d70a2d6
21
main.go
21
main.go
|
@ -73,12 +73,21 @@ func main() {
|
|||
if isSocketActivated {
|
||||
l, err = net.FileListener(os.NewFile(3, "systemd-socket"))
|
||||
fmt.Println("Listening on systemd-socket")
|
||||
|
||||
conn, err := l.Accept()
|
||||
if err != nil {
|
||||
fmt.Println("Error accepting: ", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
handleRequest(conn)
|
||||
|
||||
if *restart {
|
||||
restartUISoftware()
|
||||
}
|
||||
|
||||
} else {
|
||||
l, err = net.Listen("tcp", *CONN_HOST+":"+*CONN_PORT)
|
||||
fmt.Println("Listening on " + *CONN_HOST + ":" + *CONN_PORT)
|
||||
}
|
||||
check(err)
|
||||
defer l.Close() // Close the listener when the application closes.
|
||||
|
||||
for {
|
||||
// Listen for an incoming connection.
|
||||
|
@ -93,12 +102,12 @@ func main() {
|
|||
restartUISoftware()
|
||||
}
|
||||
|
||||
if isSocketActivated {
|
||||
break
|
||||
}
|
||||
}
|
||||
check(err)
|
||||
defer l.Close() // Close the listener when the application closes.
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func debug(msg ...string) {
|
||||
if LOG_LEVEL == "debug" {
|
||||
|
|
Loading…
Reference in a new issue