Skip to content

Commit

Permalink
Cory Nelson made libcurl use the WSAPoll() function if built for Windows
Browse files Browse the repository at this point in the history
Vista (_WIN32_WINNT >= 0x0600)
  • Loading branch information
bagder committed Sep 24, 2006
1 parent fe8aee6 commit 1fa3a5c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@


Changelog Changelog


Daniel (24 September 2006)
- Cory Nelson made libcurl use the WSAPoll() function if built for Windows
Vista (_WIN32_WINNT >= 0x0600)

Daniel (23 September 2006) Daniel (23 September 2006)
- Mike Protts added --ftp-ssl-control to make curl use FTP-SSL, but only - Mike Protts added --ftp-ssl-control to make curl use FTP-SSL, but only
encrypt the control connection and use the data connection "plain". encrypt the control connection and use the data connection "plain".
Expand Down
3 changes: 2 additions & 1 deletion RELEASE-NOTES
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Curl and libcurl 7.16.0


This release includes the following changes: This release includes the following changes:


o uses WSAPoll() on Windows Vista
o (FTP) --ftp-ssl-control was added o (FTP) --ftp-ssl-control was added
o CURLOPT_SSL_SESSIONID_CACHE and --no-sessionid added o CURLOPT_SSL_SESSIONID_CACHE and --no-sessionid added
o CURLMOPT_PIPELINING added for enabling pipelined transfers o CURLMOPT_PIPELINING added for enabling pipelined transfers
Expand Down Expand Up @@ -54,6 +55,6 @@ advice from friends like these:
Domenico Andreoli, Armel Asselin, Gisle Vanem, Yang Tse, Andrew Biggs, Domenico Andreoli, Armel Asselin, Gisle Vanem, Yang Tse, Andrew Biggs,
Peter Sylvester, David McCreedy, Dmitriy Sergeyev, Dmitry Rechkin, Peter Sylvester, David McCreedy, Dmitriy Sergeyev, Dmitry Rechkin,
Jari Sundell, Ravi Pratap, Michele Bini, Jeff Pohlmeyer, Michael Wallner, Jari Sundell, Ravi Pratap, Michele Bini, Jeff Pohlmeyer, Michael Wallner,
Mike Protts Mike Protts, Cory Nelson


Thanks! (and sorry if I forgot to mention someone) Thanks! (and sorry if I forgot to mention someone)
10 changes: 8 additions & 2 deletions lib/select.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -74,7 +74,7 @@
*/ */
int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms)
{ {
#ifdef HAVE_POLL_FINE #if defined(HAVE_POLL_FINE) || defined(CURL_HAVE_WSAPOLL)
struct pollfd pfd[2]; struct pollfd pfd[2];
int num; int num;
int r; int r;
Expand All @@ -92,9 +92,13 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms)
num++; num++;
} }


#ifdef HAVE_POLL_FINE
do { do {
r = poll(pfd, num, timeout_ms); r = poll(pfd, num, timeout_ms);
} while((r == -1) && (errno == EINTR)); } while((r == -1) && (errno == EINTR));
#else
r = WSAPoll(pfd, num, timeout_ms);
#endif


if (r < 0) if (r < 0)
return -1; return -1;
Expand Down Expand Up @@ -194,6 +198,8 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
do { do {
r = poll(ufds, nfds, timeout_ms); r = poll(ufds, nfds, timeout_ms);
} while((r == -1) && (errno == EINTR)); } while((r == -1) && (errno == EINTR));
#elif defined(CURL_HAVE_WSAPOLL)
r = WSAPoll(ufds, nfds, timeout_ms);
#else #else
struct timeval timeout; struct timeval timeout;
struct timeval *ptimeout; struct timeval *ptimeout;
Expand Down
6 changes: 5 additions & 1 deletion lib/select.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
Expand All @@ -25,6 +25,10 @@


#ifdef HAVE_SYS_POLL_H #ifdef HAVE_SYS_POLL_H
#include <sys/poll.h> #include <sys/poll.h>
#elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
/* for Vista, use WSAPoll(). */
#include <winsock2.h>
#define CURL_HAVE_WSAPOLL
#else #else


#define POLLIN 0x01 #define POLLIN 0x01
Expand Down

0 comments on commit 1fa3a5c

Please sign in to comment.