-
Notifications
You must be signed in to change notification settings - Fork 147
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
Add an optional delay between split parts #277
base: main
Are you sure you want to change the base?
Conversation
Adding a new parameter for a position seems redundant. I think we can restore old behavior and make the delay global (649ec06). |
Didn't know there was a global delay at some point. Actually, the first thing I tried to do was to add For me, the global delay doesn't seem right in the event loop-based code. But feel free to reject this PR if you think a new parameter is not needed. |
I meant the global delay parameter. The delay can be implemented using |
Oh, OK. Then I should think about how to fix the infinite loop issue. Btw, I've also tried to implement |
Add optional parameter [,delay_ms] to pos_t in command line arguments. When this parameter is specified and is greater then zero, the next part is delayed by delay_ms milliseconds. Workaround for hufrea#271
I think, the infinite loop issue is solved now. This is a completely different approach. The main idea is to keep track of the last part (including repetitions) that was sent. Have't replace the per-part delay parameter with a global one yet, but that's not a big deal. I'll do it if everything else is fine. |
I added a count of all sent chunks, this fixes ignoring segments when specifying range ( |
Your version works fine, and the code is much cleaner! But there is still one more edge case:
There is no delay between the chunks here. This is because the chunks have a length of 0, and they are located at the end of the packet. The result of the comparison |
Should the behavior of things like |
We can keep it as is. Since the returned size |
Well, it is not that dirty... Please have a look: Trigger239@a4358ce |
I discovered that the behavior of ByeDPi depends on the presence of the option
--debug 1
in the command line arguments. This happens on my two Windows 7 machines. This is my command line:ciadpi.exe --debug 1 -U -T2 -npakistan.gov.pk -Hrussia-youtube.txt -s1 -q1 -An -Hrussia-blacklist.txt -s3 -o5+s -An -H:discord.com -s1 -o1 -At -f-1 -r3+s -As
If I remove
--debug 1
from it, videos on YouTube will no longer play. The YouTube website itself and many other blocked websites, however, are still loaded fine. This is the exact same behavior which is observed when the arguments-Hrussia-youtube.txt -s1 -q1 -An
are removed. So the combination-s1 -q1
works only when there is also--debug 1
.I'm pretty confident that
--debug 1
helps because it introduces an additional delay between the parts of a split packed. This could explain why the program doesn't work when started as a Windows service (see #271): there is no stdout in that case, debug logging takes almost no time, and this is why--debug 1
makes no difference.Probably when there are no delays caused by logging, the next call to
send()
happens before all the bytes from the previous call have been sent out through the socket. There is a functionsock_has_notsent()
implemented for Linux, but there is no such function for Windows.In this PR I've implemented a workaround for this issue. An optional parameter
[,delay_ms]
in added topos_t
in command line arguments. When this parameter is specified and is greater then zero, the next part will be delayed bydelay_ms
milliseconds. The delay is not applied after the last part (if there is no more data to send).When
-s1 -q1
is replaced with-s1,5 -q1
(which means "add 5 ms delay after sending the first byte"), ByeDPI allows to access YouTube and play videos there. It works as a service too.I'm not sure if this feature can be helpful for somebody else, or if it solves the problem only in my specific use case (the combination of the OS, hardware, network topology and ISP). I would appreciate it if someone else could test it and say that it helped them.