Skip to content

Commit

Permalink
fix negotiated options
Browse files Browse the repository at this point in the history
Signed-off-by: Benny Zlotnik <[email protected]>
  • Loading branch information
bennyz committed Jan 26, 2025
1 parent 54c1786 commit 145e10b
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,23 +273,22 @@ def _negotiate_timeout(self, requested_timeout: Optional[str]) -> float:

def _negotiate_options(self, options: dict) -> Tuple[dict, int, float]:
negotiated = {}
blksize = 512 # RFC default
blksize = self.server.block_size
timeout = self.server.timeout

if 'blksize' in options:
requested = options['blksize']
blksize = self._negotiate_block_size(requested)
if blksize != int(requested):
negotiated['blksize'] = blksize
negotiated['blksize'] = blksize

if 'timeout' in options:
requested = options['timeout']
timeout = self._negotiate_timeout(requested)
if timeout != int(requested):
negotiated['timeout'] = timeout
negotiated['timeout'] = int(timeout)

return negotiated, blksize, timeout


async def _start_transfer(self, filepath: pathlib.Path, addr: Tuple[str, int],
blksize: int, timeout: float, negotiated_options: dict):
transfer = TftpReadTransfer(
Expand Down

0 comments on commit 145e10b

Please sign in to comment.