diff --git a/ToDo.txt b/ToDo.txt index f27bb3c..09efad0 100644 --- a/ToDo.txt +++ b/ToDo.txt @@ -51,17 +51,17 @@ LOGGING: Events: - remove debug out -- proper unregister of event listeners from web app +- Done: proper unregister of event listeners from web app OTHER: -- extend installer to movee HIDScripts to a fixed absolute path -- proper error extraction from gRPC calls - +- Done: extend installer to move HIDScripts to a fixed absolute path +- Not possible (status isn't working here) proper error extraction from gRPC calls +- set date from Browser TO FIX: - remove dependencies of CLI client on service package - debug out of HIDScript puts way to much CPU load on journaling daemon (floods logs) -- allow gRPC server to abort Running HID scripts on context.Done() -> possible, testing needed +- Done: allow gRPC server to abort Running HID scripts on context.Done() -> possible, testing needed - jobs aren't deleted from global job list, unless result is fetched with waitResult. This affects interrupted jobs (f.e. timeout) and jobs run as background job --> cancelled jobs need a way to communicate back to the controller, that they could be deleted (Solution: goroutine listening for context.Done() per job in controller) diff --git a/cli_client/cmd_net.go b/cli_client/cmd_net.go index fef2ab6..1ac32f6 100644 --- a/cli_client/cmd_net.go +++ b/cli_client/cmd_net.go @@ -10,7 +10,7 @@ import ( //"github.com/mame82/P4wnP1_go/service" "strings" "strconv" - "github.com/mame82/P4wnP1_go/common" + "github.com/mame82/P4wnP1_go/common_web" ) //Empty settings used to store cobra flags @@ -234,7 +234,7 @@ func createDHCPServerSettings(iface string, ip4 string, mask4 string, disabled b Enabled: !disabled, DhcpServerSettings: &pb.DHCPServerSettings{ ListenInterface:iface, - LeaseFile: common.NameLeaseFileDHCPSrv(iface), + LeaseFile: common_web.NameLeaseFileDHCPSrv(iface), CallbackScript: "", ListenPort: 0, //Disable DNS DoNotBindInterface: false, //only listen on given interface diff --git a/cli_client/rpc_client.go b/cli_client/rpc_client.go index 2177a84..f477c9b 100644 --- a/cli_client/rpc_client.go +++ b/cli_client/rpc_client.go @@ -32,7 +32,7 @@ func ClientConnectServer(rpcHost string, rpcPort string) ( client = pb.NewP4WNP1Client(connection) // Contact the server - ctx, cancel = context.WithTimeout(context.Background(), time.Second) + ctx, cancel = context.WithTimeout(context.Background(), time.Second*3) //defer cancel() err = nil diff --git a/common/client_server.go b/common/client_server.go deleted file mode 100644 index 6c19c83..0000000 --- a/common/client_server.go +++ /dev/null @@ -1,11 +0,0 @@ -package common - -import "fmt" - -// File holds functions used by CLI client and P4wnP1 systemd service. Not to cross import the whole CLI/service -// package, is preferred over placing these functions in a contextual logic place. - -func NameLeaseFileDHCPSrv(nameIface string) (lf string) { - return fmt.Sprintf("/tmp/dnsmasq_%s.leases", nameIface) -} - diff --git a/common_web/net.go b/common_web/net.go new file mode 100644 index 0000000..1dfe28c --- /dev/null +++ b/common_web/net.go @@ -0,0 +1,5 @@ +package common_web + +func NameLeaseFileDHCPSrv(nameIface string) (lf string) { + return "/tmp/dnsmasq_" + nameIface + ".leases" +} diff --git a/service/dhcp.go b/service/dhcp.go index 840a58b..e4eb521 100644 --- a/service/dhcp.go +++ b/service/dhcp.go @@ -11,7 +11,7 @@ import ( "strconv" "syscall" "strings" - "github.com/mame82/P4wnP1_go/common" + "github.com/mame82/P4wnP1_go/common_web" ) /* @@ -30,7 +30,7 @@ func pidFileDHCPClient(nameIface string) string { } func leaseFileDHCPSrv(s *pb.DHCPServerSettings) (lf string) { - return common.NameLeaseFileDHCPSrv(s.ListenInterface) //default lease file + return common_web.NameLeaseFileDHCPSrv(s.ListenInterface) //default lease file } @@ -214,7 +214,7 @@ func StopDHCPServer(nameIface string) (err error) { os.Remove(pidFileDHCPSrv(nameIface)) //Deleting leaseFile - os.Remove(common.NameLeaseFileDHCPSrv(nameIface)) + os.Remove(common_web.NameLeaseFileDHCPSrv(nameIface)) return nil }