return result;
}
+/* return information about the shutdown connections */
unsigned int Curl_cpool_add_waitfds(struct cpool *cpool,
- struct curl_waitfds *cwfds)
+ struct Curl_waitfds *cwfds)
{
unsigned int need = 0;
return need;
}
+/* return fd_set info about the shutdown connections */
+void Curl_cpool_setfds(struct cpool *cpool,
+ fd_set *read_fd_set, fd_set *write_fd_set,
+ int *maxfd)
+{
+ CPOOL_LOCK(cpool);
+ if(Curl_llist_head(&cpool->shutdowns)) {
+ struct Curl_llist_node *e;
+
+ for(e = Curl_llist_head(&cpool->shutdowns); e;
+ e = Curl_node_next(e)) {
+ struct easy_pollset ps;
+ unsigned int i;
+ struct connectdata *conn = Curl_node_elem(e);
+ memset(&ps, 0, sizeof(ps));
+ Curl_attach_connection(cpool->idata, conn);
+ Curl_conn_adjust_pollset(cpool->idata, &ps);
+ Curl_detach_connection(cpool->idata);
+
+ for(i = 0; i < ps.num; i++) {
+#if defined(__DJGPP__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warith-conversion"
+#endif
+ if(ps.actions[i] & CURL_POLL_IN)
+ FD_SET(ps.sockets[i], read_fd_set);
+ if(ps.actions[i] & CURL_POLL_OUT)
+ FD_SET(ps.sockets[i], write_fd_set);
+#if defined(__DJGPP__)
+#pragma GCC diagnostic pop
+#endif
+ if((ps.actions[i] & (CURL_POLL_OUT | CURL_POLL_IN)) &&
+ ((int)ps.sockets[i] > *maxfd))
+ *maxfd = (int)ps.sockets[i];
+ }
+ }
+ }
+ CPOOL_UNLOCK(cpool);
+}
+
static void cpool_perform(struct cpool *cpool)
{
struct Curl_easy *data = cpool->idata;
struct connectdata;
struct Curl_easy;
struct curl_pollfds;
-struct curl_waitfds;
+struct Curl_waitfds;
struct Curl_multi;
struct Curl_share;
CURLcode Curl_cpool_add_pollfds(struct cpool *connc,
struct curl_pollfds *cpfds);
unsigned int Curl_cpool_add_waitfds(struct cpool *connc,
- struct curl_waitfds *cwfds);
+ struct Curl_waitfds *cwfds);
+
+void Curl_cpool_setfds(struct cpool *cpool,
+ fd_set *read_fd_set, fd_set *write_fd_set,
+ int *maxfd);
/**
* Perform maintenance on connections in the pool. Specifically,
int this_max_fd = -1;
struct Curl_llist_node *e;
struct Curl_multi *multi = m;
+ unsigned int i;
(void)exc_fd_set; /* not used */
if(!GOOD_MULTI_HANDLE(multi))
for(e = Curl_llist_head(&multi->process); e; e = Curl_node_next(e)) {
struct Curl_easy *data = Curl_node_elem(e);
- unsigned int i;
multi_getsock(data, &data->last_poll);
}
}
+ Curl_cpool_setfds(&multi->cpool, read_fd_set, write_fd_set, &this_max_fd);
+
*max_fd = this_max_fd;
return CURLM_OK;
unsigned int size,
unsigned int *fd_count)
{
- struct curl_waitfds cwfds;
+ struct Curl_waitfds cwfds;
CURLMcode result = CURLM_OK;
struct Curl_llist_node *e;
struct Curl_multi *multi = m;
return CURLE_OK;
}
-void Curl_waitfds_init(struct curl_waitfds *cwfds,
+void Curl_waitfds_init(struct Curl_waitfds *cwfds,
struct curl_waitfd *static_wfds,
unsigned int static_count)
{
cwfds->count = static_count;
}
-static unsigned int cwfds_add_sock(struct curl_waitfds *cwfds,
+static unsigned int cwfds_add_sock(struct Curl_waitfds *cwfds,
curl_socket_t sock, short events)
{
int i;
return 1;
}
-unsigned int Curl_waitfds_add_ps(struct curl_waitfds *cwfds,
+unsigned int Curl_waitfds_add_ps(struct Curl_waitfds *cwfds,
struct easy_pollset *ps)
{
size_t i;
CURLcode Curl_pollfds_add_sock(struct curl_pollfds *cpfds,
curl_socket_t sock, short events);
-struct curl_waitfds {
+struct Curl_waitfds {
struct curl_waitfd *wfds;
unsigned int n;
unsigned int count;
};
-void Curl_waitfds_init(struct curl_waitfds *cwfds,
+void Curl_waitfds_init(struct Curl_waitfds *cwfds,
struct curl_waitfd *static_wfds,
unsigned int static_count);
-unsigned int Curl_waitfds_add_ps(struct curl_waitfds *cwfds,
+unsigned int Curl_waitfds_add_ps(struct Curl_waitfds *cwfds,
struct easy_pollset *ps);
#endif /* HEADER_CURL_SELECT_H */