diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-08-12 09:19:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-08-12 09:19:20 +0000 |
commit | b6d97fef4669d07c108b130ea882f19a737d2ae9 (patch) | |
tree | c2f7a4e2e0ba7f963db3a9041d4644e70bd0024c /src/net_dot.c | |
parent | Updating watch file. (diff) | |
download | dnsperf-b6d97fef4669d07c108b130ea882f19a737d2ae9.tar.xz dnsperf-b6d97fef4669d07c108b130ea882f19a737d2ae9.zip |
Merging upstream version 2.7.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/net_dot.c')
-rw-r--r-- | src/net_dot.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/net_dot.c b/src/net_dot.c index a662f7d..6b53e35 100644 --- a/src/net_dot.c +++ b/src/net_dot.c @@ -61,8 +61,6 @@ static void perf__dot_connect(struct perf_net_socket* sock) { int ret; - self->is_ready = true; - int fd = socket(self->server.sa.sa.sa_family, SOCK_STREAM, 0); if (fd == -1) { char __s[256]; @@ -119,12 +117,14 @@ static void perf__dot_connect(struct perf_net_socket* sock) } if (connect(sock->fd, &self->server.sa.sa, self->server.length)) { if (errno == EINPROGRESS) { - self->is_ready = false; + return; } else { char __s[256]; perf_log_fatal("connect() failed: %s", perf_strerror_r(errno, __s, sizeof(__s))); } } + + self->is_conn_ready = true; } static void perf__dot_reconnect(struct perf_net_socket* sock) @@ -136,6 +136,7 @@ static void perf__dot_reconnect(struct perf_net_socket* sock) self->sending = 0; self->is_sending = false; } + self->is_ready = false; self->is_conn_ready = false; perf__dot_connect(sock); } @@ -416,7 +417,7 @@ static bool perf__dot_have_more(struct perf_net_socket* sock) return self->have_more; } -struct perf_net_socket* perf_net_dot_opensocket(const perf_sockaddr_t* server, const perf_sockaddr_t* local, size_t bufsize) +struct perf_net_socket* perf_net_dot_opensocket(const perf_sockaddr_t* server, const perf_sockaddr_t* local, size_t bufsize, void* data, perf_net_sent_cb_t sent, perf_net_event_cb_t event) { struct perf__dot_socket* tmp = calloc(1, sizeof(struct perf__dot_socket)); // clang scan-build struct perf_net_socket* sock = (struct perf_net_socket*)tmp; @@ -433,6 +434,10 @@ struct perf_net_socket* perf_net_dot_opensocket(const perf_sockaddr_t* server, c sock->sockready = perf__dot_sockready; sock->have_more = perf__dot_have_more; + sock->data = data; + sock->sent = sent; + sock->event = event; + self->server = *server; self->local = *local; self->bufsize = bufsize; |