summaryrefslogtreecommitdiff
path: root/bufferevent-internal.h
diff options
context:
space:
mode:
authorAzat Khuzhin <a3at.mail@gmail.com>2014-11-15 21:46:11 +0300
committerAzat Khuzhin <a3at.mail@gmail.com>2015-08-18 20:06:52 +0300
commit8bb3842552a6003f578821fad12984867757a6fb (patch)
tree43281797d6cc34f3b96bf483eb3230f25c1b8990 /bufferevent-internal.h
parentdc33c78391eb24a41215cdfea5fbdcfe90140405 (diff)
downloadlibevent-8bb3842552a6003f578821fad12984867757a6fb.tar.gz
bufferevent: move conn_address out from http into bufferevent
In http the only case when when we could store it is when we already connected, *but* if we are doing request using domain name, then we need to do request to nameserver to get IP address, and this is handled by bufferevent. So when we have IP address (from nameserver) and don't have connection to this IP address, we could already cache it to avoid extra DNS requests (since UDP is slow), and we can't do this from http layer, only from bufferevent.
Diffstat (limited to 'bufferevent-internal.h')
-rw-r--r--bufferevent-internal.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/bufferevent-internal.h b/bufferevent-internal.h
index ad3dcfc9..ac32384c 100644
--- a/bufferevent-internal.h
+++ b/bufferevent-internal.h
@@ -205,6 +205,15 @@ struct bufferevent_private {
/** Rate-limiting information for this bufferevent */
struct bufferevent_rate_limit *rate_limiting;
+
+ /* Saved conn_addr, to extract IP address from it.
+ *
+ * Because some servers may reset/close connection without waiting clients,
+ * in that case we can't extract IP address even in close_cb.
+ * So we need to save it, just after we connected to remote server, or
+ * after resolving (to avoid extra dns requests during retrying, since UDP
+ * is slow) */
+ struct sockaddr_storage *conn_address;
};
/** Possible operations for a control callback. */
@@ -392,6 +401,9 @@ int bufferevent_generic_adj_timeouts_(struct bufferevent *bev);
enum bufferevent_options bufferevent_get_options_(struct bufferevent *bev);
+const struct sockaddr*
+bufferevent_socket_get_conn_address_(struct bufferevent *bev);
+
/** Internal use: We have just successfully read data into an inbuf, so
* reset the read timeout (if any). */
#define BEV_RESET_GENERIC_READ_TIMEOUT(bev) \