Skip to content

Make select_read timeout configurable #488

@nioncode

Description

@nioncode

I'm using httplib during tests of a client application in order to verify the requests that are made, which works great so far (thanks!).

However, I'm running into a performance problem: for each test case, I'm creating a new Server, listen for requests (on a separate thread), and stop the server (and join the thread) after the test finished. The problem is that the listen call only returns after ~100ms, which is caused by the 100000 usec timeout of select_read (inside the listen_internal method). If I change this timeout to 0, my tests finish in 5ms instead of 105ms (multiplied by the number of test cases, which quickly adds up).

It would be great if we could configure the timeout or completely disable the select call. Maybe it even makes sense to set this value to 0 automatically when the stop method is called? I don't know much about the effects of this, but from my understanding, when I ask the server to stop, it should stop as fast as possible and not wait for some timeouts on sockets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions