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.readConfig()
|
||||
|
||||
if HaveCommandLineOptions() || !a.Config.Application.AllowMultiInstance {
|
||||
if haveCLI := HaveCommandLineOptions(); haveCLI || !a.Config.Application.AllowMultiInstance {
|
||||
connected, err := a.checkCLIFlagsAndSendIPCMsg()
|
||||
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 */ {
|
||||
return nil, ErrAnotherInstance
|
||||
@@ -125,11 +128,16 @@ func StartupApp(appName, displayAppName, appVersionTag, latestReleaseURL string)
|
||||
})
|
||||
|
||||
// Start IPC server
|
||||
if !a.lastWrittenCfg.Application.AllowMultiInstance {
|
||||
ipc.DestroyConn() // cleanup socket possibly orphaned by crashed process
|
||||
}
|
||||
listener, err := ipc.Listen()
|
||||
if err == nil {
|
||||
a.ipcServer = ipc.NewServer(a.PlaybackManager, a.callOnReactivate,
|
||||
func() { _ = a.callOnExit() })
|
||||
go a.ipcServer.Serve(listener)
|
||||
} else {
|
||||
log.Printf("error starting IPC server: %s", err.Error())
|
||||
}
|
||||
|
||||
// OS media center integrations
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
@@ -77,7 +76,6 @@ func (c *Client) sendRequest(path string) error {
|
||||
resp, err := c.httpC.Get("http://supersonic/" + path)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("http err: %v\n", err)
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
Reference in New Issue
Block a user