Skip to content

Commit

Permalink
Add the ability to specify whether to use direct sockets or not
Browse files Browse the repository at this point in the history
  • Loading branch information
ziotom78 committed May 25, 2023
1 parent 08586ac commit 94350ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
12 changes: 10 additions & 2 deletions program_batch_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@ def main(stdscr):
if not args.dry_run:
print(f"{len(cur_json_procedure)} commands ready to be executed, let's go!")
print("Going to establish a connection with the server…")
conn = StripConnection()
conn = StripConnection(use_fast_socket=not args.https_connection)
conn.login()
if close_tags(stdscr, conn):
return

print("…connection established")
print(
"…connection established, fast socket connection is {'enabled' if conn.use_fast_socket else 'disabled'}"
)

if (not args.dry_run) and (not args.do_not_round):
conn.round_all_files()
Expand Down Expand Up @@ -279,6 +281,12 @@ def main(stdscr):
action="store_true",
help="Wait a key before ending the procedure",
)
parser.add_argument(
"--https-connection",
default=False,
action="store_true",
help="If set to True, avoid using direct socket communication even if available",
)
parser.add_argument(
"--wait-time",
metavar="SECONDS",
Expand Down
10 changes: 8 additions & 2 deletions striptease/stripconn.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,15 @@ class StripConnection(Connection):
"""

def __init__(
self, user=None, password=None, addr=None, schema=None, post_command=None
self,
user=None,
password=None,
addr=None,
schema=None,
post_command=None,
use_fast_socket=True,
):
super(StripConnection, self).__init__()
super(StripConnection, self).__init__(use_fast_socket=use_fast_socket)

self.__user = user
self.__password = password
Expand Down

0 comments on commit 94350ef

Please sign in to comment.