Permalink
Browse files

PATH appended in fruhod service. Displaying failed status

  • Loading branch information...
pulpofred
pulpofred committed Aug 23, 2015
1 parent 5479bb0 commit a8c88389db931299b1c24e862c21f3ec4b228d43
Showing with 35 additions and 7 deletions.
  1. BIN fruho/images/32/status/failed.png
  2. +22 −1 fruho/main.tcl
  3. +1 −0 fruho/model.tcl
  4. +1 −0 fruhod/exclude/etc/init.d/fruhod
  5. +11 −6 fruhod/main.tcl
Binary file not shown.
@@ -391,6 +391,9 @@ proc mainstatusline-update {stat} {
dict set ::model::Mainstatusline TIMEOUT ""
set ::model::Mainstatusline_last "Last connection timed out. Consider increasing timeout in settings."
set ::model::Mainstatusline_link "see logs"
} elseif {$connstatus eq "failed"} {
dict set ::model::Mainstatusline FAILED ""
set ::model::Mainstatusline_link "see logs"
} elseif {$connstatus eq "cancelled"} {
dict set ::model::Mainstatusline CANCELLED ""
set ::model::Mainstatusline_link ""
@@ -1045,6 +1048,7 @@ proc connect-button-stand {} {
connected {set state disabled}
timeout {set state disabled}
cancelled {set state disabled}
failed {set state disabled}
default {set state disabled}
}
return $state
@@ -1069,6 +1073,7 @@ proc disconnect-button-stand {} {
connected {set state normal}
timeout {set state disabled}
cancelled {set state disabled}
failed {set state disabled}
default {set state disabled}
}
return $state
@@ -1106,7 +1111,8 @@ proc connect-msg-stand {} {
unknown {set msg [_ "Unknown"]}
disconnected {set msg [_ "Disconnected"]}
timeout {set msg [_ "Disconnected"]}
cancelled {set msg [_ "Disconnected"]}
cancelled {set msg [_ "Disconnected"]}
failed {set msg [_ "Disconnected"]}
connecting {
if {$city ne "" && $ccode ne ""} {
set msg [_ "Connecting to {0}, {1}" $city $ccode]
@@ -2761,6 +2767,11 @@ proc ffread-loop {} {
}
}
}
{^OpenVPN ERROR} {
$::model::Chan_openvpn_fail <- [lindex $tokens 1]
puts $::model::OPENVPNLOG [lindex $tokens 1]
flush $::model::OPENVPNLOG
}
}
}
{^ovpn: (.*)$} {
@@ -2979,6 +2990,16 @@ proc connstatus-loop {} {
}
mainstatusline-update $stat
}
<- $::model::Chan_openvpn_fail {
set msg [<- $::model::Chan_openvpn_fail]
set ::model::Mainstatusline_last "Last connection failed. [string range $msg 0 70]"
connection-windup
model connstatus failed
# this cancels the timeout
set chtimeout $empty_channel
gui-update
mainstatusline-update $stat
}
<- $chtimeout {
<- $chtimeout
pq 42 timeout
@@ -137,6 +137,7 @@ if 0 { variable Profiles [dict create fruho {
csp::channel ::model::Chan_button_connect
csp::channel ::model::Chan_button_disconnect
csp::channel ::model::Chan_stat_report
csp::channel ::model::Chan_openvpn_fail
csp::channel ::model::Chan_ffread
@@ -7,6 +7,7 @@
EXEC=/usr/local/sbin/fruhod.bin
PIDFILE=/var/run/fruhod.pid
LOGFILE=/var/log/fruhod.log
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#TODO this check should be only for start/stop. Allow check status for regular users
@@ -227,12 +227,17 @@ proc ffread {} {
model reset-ovpn-state
set config [adjust-config $::model::ovpn_config]
set ovpncmd "openvpn $config"
set chan [cmd invoke $ovpncmd OvpnExit OvpnRead OvpnErrRead]
set ::model::Start_pid [pid $chan]
set ::model::Start_pid_tstamp [clock milliseconds]
# this call is necessary to update ovpn_pid
ovpn-pid
ffwrite ctrl "OpenVPN with pid [ovpn-pid] started"
try {
set chan [cmd invoke $ovpncmd OvpnExit OvpnRead OvpnErrRead]
set ::model::Start_pid [pid $chan]
set ::model::Start_pid_tstamp [clock milliseconds]
# this call is necessary to update ovpn_pid
ovpn-pid
ffwrite ctrl "OpenVPN with pid [ovpn-pid] started"
} on error {e1 e2} {
ffwrite ctrl "OpenVPN ERROR: $e1"
log $e1 $e2
}
return
}
}

0 comments on commit a8c8838

Please sign in to comment.