增加event_del

This commit is contained in:
崔一鸣
2019-07-18 19:56:50 +08:00
parent c67df95633
commit 65000c889e

View File

@@ -787,7 +787,9 @@ static void peek_client_hello_cb(evutil_socket_t fd, short what, void * arg)
n = recv(fd, buf, sizeof(buf), MSG_PEEK);
if (n == -1)
{
TFE_LOG_ERROR(ctx->logger, "Error peeking on fd, aborting connection\n");
char* addr_string=tfe_string_addr_create_by_fd(fd, CONN_DIR_DOWNSTREAM);
TFE_LOG_ERROR(ctx->logger, "Error peeking on fd, aborting connection, addr_string is %s, errno is %d, errmsg is %s\n", addr_string, errno, strerror(errno));
free(addr_string);
goto failed;
}
@@ -827,7 +829,7 @@ static void peek_client_hello_cb(evutil_socket_t fd, short what, void * arg)
* never actually read them, fd is still ready for
* reading now. We use 25 * 0.2 s = 5 s timeout. */
struct timeval retry_delay = {0, 100};
event_del(ctx->ev);
event_free(ctx->ev);
ctx->ev = event_new(ctx->evbase, fd, 0, peek_client_hello_cb, promise);
assert(ctx->ev != NULL);