Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions plugins.d/Lets_Encrypt/add-water-srv
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,21 @@ def test(randompath):
def handle_token_input():
host = "127.0.0.1"
port = 9977
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind((host, port))
sock.listen(1)
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind((host, port))
sock.listen(1)

# client will only send 1 token per connection, might be
# more effecient way of doing this, but unsure how with dehydrated
while True:
conn, addr = sock.accept()

token = conn.recv(4096).decode("utf8")
print(f"Got token {token} from {addr}: serving")
token_queue.put(token)
# client will only send 1 token per connection, might be
# more effecient way of doing this, but unsure how with dehydrated
while True:
conn, addr = sock.accept()

conn.close()
token = conn.recv(4096).decode("utf8")
print(f"Got token {token} from {addr}: serving")
token_queue.put(token)

sock.close()
conn.close()


if __name__ == "__main__":
Expand Down