Skip to content

Add support for timeout. Change from select syscall to poll #210

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nveloso
Copy link

@nveloso nveloso commented Oct 18, 2021

Hi! In this PR I added support for specifying the timeout used in sockets via an argument.
I changed the use of select syscall to poll syscall. Select syscall has a known limitation:

WARNING: select() can monitor only file descriptors numbers that
are less than FD_SETSIZE (1024)—an unreasonably low limit for
many modern applications—and this limitation will not change.
All modern applications should instead use poll(2) or epoll(7),
which do not suffer this limitation.

Taken from https://man7.org/linux/man-pages/man2/select.2.html

I also make the BaseDisplay class public because it can be useful to connect to a X11 server without making several requests to get all the extensions available.

I also added a check in parse_connection_setup method that checks if the response has a valid status. In the protocol specification page 11 and 114 you can see all the available status (0, 1 or 2).

I ran the tests with python3 runtests.py and all passed.

----------------------------------------------------------------------
XML: /com.docker.devenvironments.code/nosetests.xml
----------------------------------------------------------------------
Ran 524 tests in 12.184s

OK (SKIP=142)

I hope you can merge my changes. Any question feel free to ask.

nunovelosobs and others added 2 commits October 18, 2021 14:11
…fication in server connection setup response. Make BaseDisplay class public
@codecov-commenter
Copy link

Codecov Report

Merging #210 (c1e928b) into master (1a30315) will increase coverage by 0.04%.
The diff coverage is 82.35%.

@@            Coverage Diff             @@
##           master     #210      +/-   ##
==========================================
+ Coverage   78.12%   78.16%   +0.04%     
==========================================
  Files          41       41              
  Lines        4645     4704      +59     
==========================================
+ Hits         3629     3677      +48     
- Misses       1016     1027      +11     

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

Successfully merging this pull request may close these issues.

3 participants