Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
zrquan committed Sep 8, 2024
1 parent 96ed5d8 commit c5e145d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
5 changes: 2 additions & 3 deletions lib/connection/requester.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,13 @@ def __init__(self):
super().__init__()

transport = httpx.AsyncHTTPTransport(
# FIXME: max_connections != thread_count
verify=False,
cert=self._cert,
limits=httpx.Limits(max_connections=options["thread_count"]),
socket_options=self._socket_options,
)

self.session = httpx.AsyncClient(
verify=False,
cert=self._cert,
mounts={"http://": transport, "https://": transport},
timeout=httpx.Timeout(options["timeout"]),
)
Expand Down
18 changes: 9 additions & 9 deletions lib/controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,20 +305,20 @@ def start(self):

async def _start_coroutines(self):
task = self.loop.create_task(self.fuzzer.start())
done, _ = await asyncio.wait(
[self.done_future, task],
timeout=options["max_time"] if options["max_time"] > 0 else None,
return_when=asyncio.FIRST_COMPLETED,
)
max_time = options["max_time"] if options["max_time"] > 0 else None
try:
async with asyncio.timeout(max_time):
await asyncio.wait(
[self.done_future, task],
return_when=asyncio.FIRST_COMPLETED,
)
except asyncio.TimeoutError:
raise SkipTargetInterrupt("Runtime exceeded the maximum set by the user")

if self.done_future.done():
task.cancel()
await self.done_future # propagate the exception, if raised

# TODO: find a better way to catch TimeoutError
if len(done) == 0:
raise SkipTargetInterrupt("Runtime exceeded the maximum set by the user")

def set_target(self, url):
# If no scheme specified, unset it first
if "://" not in url:
Expand Down

0 comments on commit c5e145d

Please sign in to comment.