Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--ack-timeout and --conn-timeout do not seem to work #3

Closed
jpmzometa opened this issue Jan 12, 2018 · 4 comments
Closed

--ack-timeout and --conn-timeout do not seem to work #3

jpmzometa opened this issue Jan 12, 2018 · 4 comments

Comments

@jpmzometa
Copy link

Starting the TFTP server as follows does not change the default timeouts:
py3tftp -p 9069 --ack-timeout 5 --conn-timeout 10 -v

using Wireshark, I can see the timeouts are still ack-timeout=0.5 and conn-timeout=5.0.

The debug output of py3tftp shows the following:
2018-01-12 14:49:40,987 [INFO] Starting TFTP server on 0.0.0.0:9069
2018-01-12 14:49:40,988 [DEBUG] Using selector: KqueueSelector
2018-01-12 14:49:40,988 [INFO] Listening...
2018-01-12 14:50:02,492 [DEBUG] received: test.txtoctettsize0blksize508
2018-01-12 14:50:02,492 [DEBUG] Request: b'test.txt\x00octet\x00tsize\x000\x00blksize\x00508\x00'
2018-01-12 14:50:02,492 [DEBUG] b'tsize'
2018-01-12 14:50:02,493 [DEBUG] b'blksize'
2018-01-12 14:50:02,493 [DEBUG] packet type: RRQ
2018-01-12 14:50:02,493 [DEBUG] Request: b'test.txt\x00octet\x00tsize\x000\x00blksize\x00508\x00'
2018-01-12 14:50:02,494 [DEBUG] b'tsize'
2018-01-12 14:50:02,494 [DEBUG] b'blksize'
2018-01-12 14:50:02,494 [DEBUG] b'blksize'
2018-01-12 14:50:02,494 [INFO] Initiating RRQProtocol with ('127.0.0.1', 9997)
2018-01-12 14:50:02,495 [DEBUG] {b'blksize': 508}
2018-01-12 14:50:02,495 [DEBUG] {b'ack_timeout': 0.5, b'timeout': 5.0, b'blksize': 508, 'ack_timeout': 5.0, 'timeout': 10.0}
[DEBUG] {b'ack_timeout': 0.5, b'timeout': 5.0, b'blksize': 508, 'ack_timeout': 5.0, 'timeout': 10.0}
...

Any idea where the problem might be?
Regards,

sirMackk added a commit that referenced this issue Jan 20, 2018
@sirMackk
Copy link
Owner

Hi @jpmzometa, thanks for catching this bug. I think I messed up how strings/bytes are handled in a specific spot.

I've created a possible fix on a different branch: https://github.com/sirMackk/py3tftp/tree/issue_3_fix, would it be possible for you to run the code from that branch and see if your issue is fixed? If you're not comfortable with the python toolchain, I can help out a bit and guide you.

@sirMackk
Copy link
Owner

sirMackk commented Feb 3, 2018

Hi @jpmzometa, can you confirm if the patch fixes the problem?

@jpmzometa
Copy link
Author

Hi. I tested it and it seems to work, but not as I expected. I guess the documentation is not clear on the meaning of --conn-timeout:

Timeout before the server gives up on a transfer and closes the connection.

As it now is, this timer seems to be reset every time a packet arrives at the server. I thought it was a sort of "global" timer, that starts as soon as a transfer is requested, and if the full transfer is not finished before the timer expires, the connection should be closed. Anyways, the current implementation of --conn-timeout is fine as it is, just the documentation is not very clear.

@sirMackk
Copy link
Owner

sirMackk commented Feb 7, 2018

Great, many thanks @jpmzometa! I'll expand the readme to include that bit of information and I'll create a new release for pypi this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants