a few fixes
This commit is contained in:
+10
-2
@@ -91,10 +91,13 @@ func StartupApp(appName, displayAppName, appVersionTag, latestReleaseURL string)
|
|||||||
a.bgrndCtx, a.cancel = context.WithCancel(context.Background())
|
a.bgrndCtx, a.cancel = context.WithCancel(context.Background())
|
||||||
a.readConfig()
|
a.readConfig()
|
||||||
|
|
||||||
if HaveCommandLineOptions() || !a.Config.Application.AllowMultiInstance {
|
if haveCLI := HaveCommandLineOptions(); haveCLI || !a.Config.Application.AllowMultiInstance {
|
||||||
connected, err := a.checkCLIFlagsAndSendIPCMsg()
|
connected, err := a.checkCLIFlagsAndSendIPCMsg()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("error sending IPC message: %s", err.Error())
|
if haveCLI {
|
||||||
|
// we were supposed to control another instance and couldn't
|
||||||
|
log.Fatalf("error sending IPC message: %s", err.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if connected /* we reached the other instance at all */ {
|
if connected /* we reached the other instance at all */ {
|
||||||
return nil, ErrAnotherInstance
|
return nil, ErrAnotherInstance
|
||||||
@@ -125,11 +128,16 @@ func StartupApp(appName, displayAppName, appVersionTag, latestReleaseURL string)
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Start IPC server
|
// Start IPC server
|
||||||
|
if !a.lastWrittenCfg.Application.AllowMultiInstance {
|
||||||
|
ipc.DestroyConn() // cleanup socket possibly orphaned by crashed process
|
||||||
|
}
|
||||||
listener, err := ipc.Listen()
|
listener, err := ipc.Listen()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
a.ipcServer = ipc.NewServer(a.PlaybackManager, a.callOnReactivate,
|
a.ipcServer = ipc.NewServer(a.PlaybackManager, a.callOnReactivate,
|
||||||
func() { _ = a.callOnExit() })
|
func() { _ = a.callOnExit() })
|
||||||
go a.ipcServer.Serve(listener)
|
go a.ipcServer.Serve(listener)
|
||||||
|
} else {
|
||||||
|
log.Printf("error starting IPC server: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// OS media center integrations
|
// OS media center integrations
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"log"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
@@ -77,7 +76,6 @@ func (c *Client) sendRequest(path string) error {
|
|||||||
resp, err := c.httpC.Get("http://supersonic/" + path)
|
resp, err := c.httpC.Get("http://supersonic/" + path)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("http err: %v\n", err)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|||||||
Reference in New Issue
Block a user