1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[select] SOCK_SHIFT for curl under Windows

This commit is contained in:
Witold Filipczyk 2023-11-06 19:04:14 +01:00
parent bada330202
commit 8164715d0f

View File

@ -82,6 +82,10 @@ do { \
#define FD_SETSIZE 1024
#endif
#ifndef __STRING
#define __STRING(x) #x
#endif
#if defined(CONFIG_LIBEVENT) && defined(CONFIG_LIBCURL)
/* Information associated with a specific easy handle */
typedef struct _ConnInfo
@ -105,6 +109,7 @@ typedef struct _SockInfo
GlobalInfo g;
#define mycase(code) \
case code: s = __STRING(code)
@ -462,6 +467,12 @@ sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
#endif
#if !defined(CONFIG_LIBEVENT) && !defined(CONFIG_LIBEV) && defined(CONFIG_LIBCURL)
#ifdef CONFIG_OS_WIN32
#define SOCK_SHIFT 1024
#else
#define SOCK_SHIFT 0
#endif
/* Information associated with a specific easy handle */
typedef struct _ConnInfo
{
@ -579,10 +590,9 @@ static void
remsock(SockInfo *f)
{
//fprintf(stderr, "remsock f=%p\n", f);
if (f) {
if (f->sockfd) {
set_handlers(f->sockfd, NULL, NULL, NULL, NULL);
set_handlers(f->sockfd + SOCK_SHIFT, NULL, NULL, NULL, NULL);
}
mem_free(f);
}
@ -599,7 +609,7 @@ setsock(SockInfo *f, curl_socket_t s, CURL *e, int act, GlobalInfo *g)
f->action = act;
f->easy = e;
set_handlers(s, in ? event_read_cb : NULL, out ? event_write_cb : NULL, NULL, f);
set_handlers(s + SOCK_SHIFT, in ? event_read_cb : NULL, out ? event_write_cb : NULL, NULL, f);
}
/* Initialize a new SockInfo structure */