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

timeout_ms less than 1 second is not supported #37

Open
GoogleCodeExporter opened this issue Jun 14, 2015 · 0 comments
Open

timeout_ms less than 1 second is not supported #37

GoogleCodeExporter opened this issue Jun 14, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Set timeout_ms to less than 1 second
2. Run a capture on an interface with no traffic
3. Record the timings of the returned calls

This is pypcap 1.1 from svn (revision 102).

I traced the bug to the following line in pcap_ex.c:
#else
    static u_char *__pkt;
    static struct pcap_pkthdr __hdr;
    struct timeval tv = { 1, 0 };
    fd_set rfds;
    int fd, n;

The timeval struct in the select call is set to 1 second timeout, regardless of 
the timeout_ms value passed in. I attached a patch that changes the struct to:
struct timeval tv = { 0, 1000 };
i.e. a timeout of 1 ms. Sub ms timeout probably doesn't make sense anyway.

I think that's the right way to resolve that, unless I missed something.

Original issue reported on code.google.com by timur.al...@gmail.com on 2 Mar 2012 at 9:52

Attachments:

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

No branches or pull requests

1 participant