Skip to content

Commit

Permalink
check client vpn end of loop cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
ab77 committed Dec 3, 2023
1 parent c69b5be commit 1767215
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion unzoner/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ RUN if [ "$BUILD_OPENSSL" = '1' ]; then \

# https://stackoverflow.com/a/39006247/1559300
RUN if [ "$BUILD_OPENVPN" = '1' ]; then \
set -x; wget --retry-on-host-error --retry-connrefused --waitretry=2 -q \
set -x; (wget --retry-on-host-error --retry-connrefused --waitretry=2 -q \
https://swupdate.openvpn.org/community/releases/openvpn-$BUILD_OPENVPN_VERSION.tar.gz \
|| curl --fail --retry 3 https://swupdate.openvpn.org/community/releases/openvpn-$BUILD_OPENVPN_VERSION.tar.gz \
-o openvpn-$BUILD_OPENVPN_VERSION.tar.gz) \
&& tar -xvf openvpn-$BUILD_OPENVPN_VERSION.tar.gz && cd openvpn-$BUILD_OPENVPN_VERSION \
&& if [ "$BUILD_OPENSSL" = '1' ]; then CFLAGS='-I/usr/local/ssl/include -Wl,-rpath=/usr/local/ssl/lib -Wl,-rpath=/usr/local/ssl/lib64 -L/usr/local/ssl/lib -L/usr/local/ssl/lib64' ./configure; else ./configure; fi \
&& make -j $(nproc) && make check && make install \
Expand Down
8 changes: 4 additions & 4 deletions unzoner/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def main():
with s_stderrq[idx].mutex:
s_stderrq[idx].queue.clear()

if i % LOOP_CYCLE == 0:
if i % LOOP_CYCLE == 0: # at the end of the cycle
if DEVICE_TYPE == 3 and connected: # test if double-vpn is up
try:
shell_check_output_cmd('ip link | grep {}'.format(TUN_IFACE))
Expand Down Expand Up @@ -416,7 +416,7 @@ def main():
if DEBUG: print_exc()

if connected and not connecting:
if i % LOOP_CYCLE == 0:
if i % LOOP_CYCLE == 0: # at the end of the cycle
# run speedtest
try:
if not c_stimer and dequeue_speedtest():
Expand Down Expand Up @@ -455,7 +455,8 @@ def main():
c_iotl
))

if i % POLL_FREQ == 0: # every x cycles per loop
if i % LOOP_CYCLE == 0: # at the end of the cycle
if not connected and connecting: # if client-vpn still connecting, kill and restart
try:
shell_check_output_cmd('ip link | grep {}'.format(TUN_IFACE))
geo_result = get_geo_location()
Expand All @@ -469,7 +470,6 @@ def main():
c_proc.terminate()
c_pid = None

if i % LOOP_CYCLE == 0:
try:
log_client_stats(status=connected, country=c_country)
except:
Expand Down

0 comments on commit 1767215

Please sign in to comment.