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

Use the poll() instead of select() for check state of the socket . #243

Merged
merged 17 commits into from
May 11, 2016
Merged

Use the poll() instead of select() for check state of the socket . #243

merged 17 commits into from
May 11, 2016

Conversation

DarovskikhAndrei
Copy link
Contributor

poll used by default. Optionally can use select() (set use_poll=no in configure)
It need for correct working with file descriptors more then 1023.

default is on.
default is on.
Conflicts:
	src/data-types/mailstream_socket.c
poll used by default, but optionaly can use select (set use_poll=no in confugure)
poll used by default, but optionaly can use select (set use_poll=no in confugure)
Conflicts:
	src/data-types/mailstream_socket.c
	src/data-types/mailstream_ssl.c
@@ -156,6 +156,14 @@ AC_CHECK_HEADERS(netdb.h netinet/in.h sys/socket.h)
AC_CHECK_HEADERS(sys/param.h sys/select.h inttypes.h)
AC_CHECK_HEADERS(arpa/inet.h winsock2.h)

use_poll=yes
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you set poll() not to be used by default for now since it's a risky change?
I'd like to test it for a little bit before making it the default.

Use: AC_ARG_WITH() so that we can use:

$ ./configure --with-poll

@DarovskikhAndrei
Copy link
Contributor Author

I did it.
select() used by default and new flag --with-poll for use poll()

@dinhvh
Copy link
Owner

dinhvh commented May 9, 2016

Could you investigate the build breakage, at least for Linux?

@DarovskikhAndrei
Copy link
Contributor Author

Last commit fix it. No?

r = select(max_fd + 1, &fds_read, &fds_write, NULL, &timeout);
if (r <= 0)
if (r < 0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you change it from <= 0 to < 0?

@dinhvh
Copy link
Owner

dinhvh commented May 9, 2016

Last commit fix it. No?

Thanks! I think when I commented on it, it was still red. It probably happened simultaneously :)

@DarovskikhAndrei
Copy link
Contributor Author

I found more one select() and review fix.

r = select(max_fd + 1, &fds_read, NULL, NULL, &timeout);
if (r <= 0)
return -1;

cancelled = (FD_ISSET(fd, &fds_read));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line disappeared.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@DarovskikhAndrei
Copy link
Contributor Author

have you more comments?

@dinhvh
Copy link
Owner

dinhvh commented May 11, 2016

It looks all good now! Thanks for helping with that feature!

@dinhvh dinhvh merged commit 0d17b68 into dinhvh:master May 11, 2016
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.

None yet

2 participants