test: temp change
This commit is contained in:
parent
5fd39d3c20
commit
2277cd577d
@ -1,3 +1,3 @@
|
|||||||
[settings]
|
[settings]
|
||||||
server_address = 10.20.127.226:8000
|
server_address = 10.20.14.232:8000
|
||||||
version = 1.0
|
version = 1.0
|
||||||
|
@ -29,7 +29,7 @@ def init():
|
|||||||
# load config from config file
|
# load config from config file
|
||||||
init_config()
|
init_config()
|
||||||
|
|
||||||
# get_node_list(6, server_address) # type: ignore
|
get_node_list(2, server_address) # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def init_db():
|
def init_db():
|
||||||
@ -286,7 +286,7 @@ async def recieve_request(i_m: IP_Message):
|
|||||||
if source_ip != i_m.dest_ip:
|
if source_ip != i_m.dest_ip:
|
||||||
return HTTPException(status_code=400, detail="Wrong ip")
|
return HTTPException(status_code=400, detail="Wrong ip")
|
||||||
dest_ip = i_m.source_ip
|
dest_ip = i_m.source_ip
|
||||||
threshold = random.randrange(1, 6)
|
threshold = random.randrange(1, 2)
|
||||||
own_public_key = pk
|
own_public_key = pk
|
||||||
pk_B = i_m.pk
|
pk_B = i_m.pk
|
||||||
|
|
||||||
@ -352,4 +352,4 @@ local_ip = get_own_ip()
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import uvicorn # pylint: disable=e0401
|
import uvicorn # pylint: disable=e0401
|
||||||
|
|
||||||
uvicorn.run("client:app", host="0.0.0.0", port=8003, reload=True)
|
uvicorn.run("client:app", host="0.0.0.0", port=8002, reload=True)
|
||||||
|
@ -86,7 +86,7 @@ async def delete_node(ip: str) -> None:
|
|||||||
print(f"Node with IP {ip} not found.")
|
print(f"Node with IP {ip} not found.")
|
||||||
|
|
||||||
# 接收节点心跳包
|
# 接收节点心跳包
|
||||||
@app.post("/server/heartbeat")
|
@app.get("/server/heartbeat")
|
||||||
async def receive_heartbeat(ip: str):
|
async def receive_heartbeat(ip: str):
|
||||||
cursor.execute("UPDATE nodes SET last_heartbeat = ? WHERE ip = ?", (time.time(), ip))
|
cursor.execute("UPDATE nodes SET last_heartbeat = ? WHERE ip = ?", (time.time(), ip))
|
||||||
return {"status": "received"}
|
return {"status": "received"}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user