Skip to content

Commit

Permalink
fix: update health check setup
Browse files Browse the repository at this point in the history
  • Loading branch information
cenk1cenk2 committed Jun 18, 2022
1 parent e0d3a90 commit 810b321
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions pipe/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ func HealthCheckPing(tl *TaskList[Pipe]) *Task[Pipe] {
stats := pinger.Statistics()

if stats.PacketLoss == 100 {
return fmt.Errorf("Can not reach the upstream DHCP server.")
t.Channel.Fatal <- fmt.Errorf(
"Can not ping the upstream DHCP server: %s",
t.Pipe.Health.DhcpServerAddress,
)
}

t.Log.Debugf("Ping health check to %s in avg %s.", stats.IPAddr.String(), stats.AvgRtt)
Expand Down Expand Up @@ -97,7 +100,7 @@ func HealthCheckDhcpServer(tl *TaskList[Pipe]) *Task[Pipe] {
}

if process == nil {
t.Channel.Fatal <- fmt.Errorf("SoftEther process is not alive.")
t.Channel.Fatal <- fmt.Errorf("DNSMASQ process is not alive.")
}

t.Log.Debugf(
Expand Down
8 changes: 4 additions & 4 deletions pipe/terminate.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TerminateTapInterface(tl *TaskList[Pipe]) *Task[Pipe] {
t.Pipe.SoftEther.TapInterface,
"down",
).
SetLogLevel(LOG_LEVEL_DEBUG, LOG_LEVEL_DEFAULT, LOG_LEVEL_DEBUG).
SetLogLevel(LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG).
AddSelfToTheTask()

t.CreateCommand(
Expand All @@ -97,7 +97,7 @@ func TerminateTapInterface(tl *TaskList[Pipe]) *Task[Pipe] {
"delete",
t.Pipe.SoftEther.TapInterface,
).
SetLogLevel(LOG_LEVEL_DEBUG, LOG_LEVEL_DEFAULT, LOG_LEVEL_DEBUG).
SetLogLevel(LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG).
AddSelfToTheTask()

t.CreateCommand(
Expand Down Expand Up @@ -130,15 +130,15 @@ func TerminateBridgeInterface(tl *TaskList[Pipe]) *Task[Pipe] {
t.Pipe.LinuxBridge.BridgeInterface,
"down",
).
SetLogLevel(LOG_LEVEL_DEBUG, LOG_LEVEL_DEFAULT, LOG_LEVEL_DEBUG).
SetLogLevel(LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG).
AddSelfToTheTask()

t.CreateCommand(
"brctl",
"delbr",
t.Pipe.LinuxBridge.BridgeInterface,
).
SetLogLevel(LOG_LEVEL_DEBUG, LOG_LEVEL_DEFAULT, LOG_LEVEL_DEBUG).
SetLogLevel(LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG).
AddSelfToTheTask()

return nil
Expand Down

0 comments on commit 810b321

Please sign in to comment.