summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiraj Kumar Goit <niraj.g@samsung.com>2019-12-13 19:17:06 +0530
committerNiraj Kumar Goit <niraj.g@samsung.com>2019-12-13 19:31:36 +0530
commit1d7ea7379264018ababc4b811d1fcf8bd12502f1 (patch)
tree049a19af044ca2714ab48e64c577f7e907487b05
parent6bda3dcb6678677857468433b26c35018fac418d (diff)
downloadcurl-1d7ea7379264018ababc4b811d1fcf8bd12502f1.tar.gz
curl-1d7ea7379264018ababc4b811d1fcf8bd12502f1.tar.bz2
curl-1d7ea7379264018ababc4b811d1fcf8bd12502f1.zip
Revert "ares: remove fd from multi fd set when ares is about to close the fd"submit/tizen_base/20191213.140919accepted/tizen/base/20191215.222036
ares: remove fd from multi fd set when ares is about to close the fd 8dfb92873af9de5d883e191e0097be32c78a7d0f Change-Id: Ic6ce203ae3609a539f70c5ae4cb1d4b3812ae80d Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
-rw-r--r--lib/asyn-ares.c37
-rw-r--r--lib/asyn-thread.c7
-rw-r--r--lib/asyn.h9
-rw-r--r--lib/connect.c4
-rw-r--r--lib/easy.c3
-rw-r--r--lib/multi.c8
-rw-r--r--lib/multiif.h2
-rw-r--r--lib/url.c2
-rw-r--r--packaging/curl.spec2
9 files changed, 31 insertions, 43 deletions
diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c
index 9c93ef2ef..ad334b6d8 100644
--- a/lib/asyn-ares.c
+++ b/lib/asyn-ares.c
@@ -138,17 +138,6 @@ void Curl_resolver_global_cleanup(void)
#endif
}
-
-static void Curl_ares_sock_state_cb(void *data, ares_socket_t socket_fd,
- int readable, int writable)
-{
- struct Curl_easy *easy = data;
- if(!readable && !writable) {
- DEBUGASSERT(easy);
- Curl_multi_closed(easy, socket_fd);
- }
-}
-
/*
* Curl_resolver_init()
*
@@ -156,16 +145,21 @@ static void Curl_ares_sock_state_cb(void *data, ares_socket_t socket_fd,
* URL-state specific environment ('resolver' member of the UrlState
* structure). Fills the passed pointer by the initialized ares_channel.
*/
-CURLcode Curl_resolver_init(struct Curl_easy *easy, void **resolver)
+CURLcode Curl_resolver_init(void **resolver)
{
#ifndef TIZEN_TV_EXT
int status = ares_init((ares_channel*)resolver);
#else
int status;
struct ares_options options;
- int optmask = ARES_OPT_SOCK_STATE_CB;
- options.sock_state_cb = Curl_ares_sock_state_cb;
- options.sock_state_cb_data = easy;
+ int optmask = 0;
+
+ options.timeout = DEFAULT_TIMEOUT;
+ optmask |= ARES_OPT_TIMEOUTMS;
+
+ options.tries = DEFAULT_TRIES;
+ optmask |= ARES_OPT_TRIES;
+
status = ares_init_options((ares_channel*)resolver, &options, optmask);
#endif
if(status != ARES_SUCCESS) {
@@ -198,15 +192,12 @@ void Curl_resolver_cleanup(void *resolver)
* environment ('resolver' member of the UrlState structure). Duplicates the
* 'from' ares channel and passes the resulting channel to the 'to' pointer.
*/
-CURLcode Curl_resolver_duphandle(struct Curl_easy *easy, void **to, void *from)
+int Curl_resolver_duphandle(void **to, void *from)
{
- (void)from;
- /*
- * it would be better to call ares_dup instead, but right now
- * it is not possible to set 'sock_state_cb_data' outside of
- * ares_init_options
- */
- return Curl_resolver_init(easy, to);
+ /* Clone the ares channel for the new handle */
+ if(ARES_SUCCESS != ares_dup((ares_channel*)to, (ares_channel)from))
+ return CURLE_FAILED_INIT;
+ return CURLE_OK;
}
static void destroy_async_data(struct Curl_async *async);
diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
index e7969314e..ae36b9e89 100644
--- a/lib/asyn-thread.c
+++ b/lib/asyn-thread.c
@@ -108,9 +108,8 @@ void Curl_resolver_global_cleanup(void)
* URL-state specific environment ('resolver' member of the UrlState
* structure).
*/
-CURLcode Curl_resolver_init(struct Curl_easy *easy, void **resolver)
+CURLcode Curl_resolver_init(void **resolver)
{
- (void)easy;
*resolver = calloc(1, sizeof(struct resdata));
if(!*resolver)
return CURLE_OUT_OF_MEMORY;
@@ -133,10 +132,10 @@ void Curl_resolver_cleanup(void *resolver)
* Called from curl_easy_duphandle() to duplicate resolver URL state-specific
* environment ('resolver' member of the UrlState structure).
*/
-CURLcode Curl_resolver_duphandle(struct Curl_easy *easy, void **to, void *from)
+int Curl_resolver_duphandle(void **to, void *from)
{
(void)from;
- return Curl_resolver_init(easy, to);
+ return Curl_resolver_init(to);
}
static void destroy_async_data(struct Curl_async *);
diff --git a/lib/asyn.h b/lib/asyn.h
index ccd4b1f7e..5099b3b3b 100644
--- a/lib/asyn.h
+++ b/lib/asyn.h
@@ -60,7 +60,7 @@ void Curl_resolver_global_cleanup(void);
* Returning anything else than CURLE_OK fails curl_easy_init() with the
* correspondent code.
*/
-CURLcode Curl_resolver_init(struct Curl_easy *easy, void **resolver);
+CURLcode Curl_resolver_init(void **resolver);
/*
* Curl_resolver_cleanup()
@@ -79,8 +79,7 @@ void Curl_resolver_cleanup(void *resolver);
* pointer. Returning anything else than CURLE_OK causes failed
* curl_easy_duphandle() call.
*/
-CURLcode Curl_resolver_duphandle(struct Curl_easy *easy, void **to,
- void *from);
+int Curl_resolver_duphandle(void **to, void *from);
/*
* Curl_resolver_cancel().
@@ -166,8 +165,8 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
#define Curl_resolver_is_resolved(x,y) CURLE_COULDNT_RESOLVE_HOST
#define Curl_resolver_wait_resolv(x,y) CURLE_COULDNT_RESOLVE_HOST
#define Curl_resolver_getsock(x,y,z) 0
-#define Curl_resolver_duphandle(x,y,z) CURLE_OK
-#define Curl_resolver_init(x,y) CURLE_OK
+#define Curl_resolver_duphandle(x,y) CURLE_OK
+#define Curl_resolver_init(x) CURLE_OK
#define Curl_resolver_global_init() CURLE_OK
#define Curl_resolver_global_cleanup() Curl_nop_stmt
#define Curl_resolver_cleanup(x) Curl_nop_stmt
diff --git a/lib/connect.c b/lib/connect.c
index 18645b9b7..41f220268 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -1314,7 +1314,7 @@ int Curl_closesocket(struct connectdata *conn,
conn->sock_accepted[SECONDARYSOCKET] = FALSE;
else {
int rc;
- Curl_multi_closed(conn->data, sock);
+ Curl_multi_closed(conn, sock);
Curl_set_in_callback(conn->data, true);
rc = conn->fclosesocket(conn->closesocket_client, sock);
Curl_set_in_callback(conn->data, false);
@@ -1324,7 +1324,7 @@ int Curl_closesocket(struct connectdata *conn,
if(conn)
/* tell the multi-socket code about this */
- Curl_multi_closed(conn->data, sock);
+ Curl_multi_closed(conn, sock);
sclose(sock);
diff --git a/lib/easy.c b/lib/easy.c
index 4132decc8..2612f9590 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -977,8 +977,7 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
}
/* Clone the resolver handle, if present, for the new handle */
- if(Curl_resolver_duphandle(outcurl,
- &outcurl->state.resolver,
+ if(Curl_resolver_duphandle(&outcurl->state.resolver,
data->state.resolver))
goto fail;
diff --git a/lib/multi.c b/lib/multi.c
index 52fae173c..7a2c1c350 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -2479,11 +2479,11 @@ void Curl_updatesocket(struct Curl_easy *data)
* socket again and it gets the same file descriptor number.
*/
-void Curl_multi_closed(struct Curl_easy *data, curl_socket_t s)
+void Curl_multi_closed(struct connectdata *conn, curl_socket_t s)
{
- if(data) {
+ if(conn->data) {
/* if there's still an easy handle associated with this connection */
- struct Curl_multi *multi = data->multi;
+ struct Curl_multi *multi = conn->data->multi;
if(multi) {
/* this is set if this connection is part of a handle that is added to
a multi handle, and only then this is necessary */
@@ -2491,7 +2491,7 @@ void Curl_multi_closed(struct Curl_easy *data, curl_socket_t s)
if(entry) {
if(multi->socket_cb)
- multi->socket_cb(data, s, CURL_POLL_REMOVE,
+ multi->socket_cb(conn->data, s, CURL_POLL_REMOVE,
multi->socket_userp,
entry->socketp);
diff --git a/lib/multiif.h b/lib/multiif.h
index e44646bf9..33dbdddf3 100644
--- a/lib/multiif.h
+++ b/lib/multiif.h
@@ -89,7 +89,7 @@ void Curl_multi_connchanged(struct Curl_multi *multi);
* socket again and it gets the same file descriptor number.
*/
-void Curl_multi_closed(struct Curl_easy *data, curl_socket_t s);
+void Curl_multi_closed(struct connectdata *conn, curl_socket_t s);
/*
* Add a handle and move it into PERFORM state at once. For pushed streams.
diff --git a/lib/url.c b/lib/url.c
index 73f3eb3f5..bf1eb63f8 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -576,7 +576,7 @@ CURLcode Curl_open(struct Curl_easy **curl)
data->magic = CURLEASY_MAGIC_NUMBER;
- result = Curl_resolver_init(data, &data->state.resolver);
+ result = Curl_resolver_init(&data->state.resolver);
if(result) {
DEBUGF(fprintf(stderr, "Error: resolver_init failed\n"));
free(data);
diff --git a/packaging/curl.spec b/packaging/curl.spec
index 8e4f44789..ac4f6a886 100644
--- a/packaging/curl.spec
+++ b/packaging/curl.spec
@@ -1,7 +1,7 @@
Name: curl
Summary: A utility for getting files from remote servers (FTP, HTTP, and others)
Version: 7.62.0
-Release: 4
+Release: 5
Group: Applications/Internet
License: MIT
URL: http://curl.haxx.se/