-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- coding: utf-8 -*- | ||
# ############################################################################# | ||
# Copyright (C) 2024 manatlan manatlan[at]gmail(dot)com | ||
# | ||
# MIT licence | ||
# | ||
# https://github.com/manatlan/htagweb | ||
# ############################################################################# | ||
import asyncio | ||
try: | ||
import redys.v2 | ||
|
||
_S = None | ||
|
||
################################################################################## | ||
async def start(): | ||
################################################################################## | ||
global _S | ||
# start a redys server (only one will win) | ||
_S=redys.v2.ServerProcess() | ||
|
||
# wait redys up | ||
bus=redys.v2.AClient() | ||
while 1: | ||
try: | ||
if await bus.ping()=="pong": | ||
break | ||
except: | ||
pass | ||
await asyncio.sleep(0.1) | ||
|
||
|
||
################################################################################## | ||
def stop(): | ||
################################################################################## | ||
global _S | ||
if _S: | ||
_S.stop() | ||
|
||
except ImportError: | ||
print("redys server not supported") | ||
async def start(): | ||
pass | ||
def stop(s): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters