mirror of https://github.com/xemu-project/xemu.git
curl: Keep *socket until the end of curl_sock_cb()
This does not really change anything, but it makes the code a bit easier to follow once we use @socket as the opaque pointer for aio_set_fd_handler(). Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20190910124136.10565-3-mreitz@redhat.com Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
0487861685
commit
007f339b10
10
block/curl.c
10
block/curl.c
|
@ -172,10 +172,6 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
|
||||||
|
|
||||||
QLIST_FOREACH(socket, &state->sockets, next) {
|
QLIST_FOREACH(socket, &state->sockets, next) {
|
||||||
if (socket->fd == fd) {
|
if (socket->fd == fd) {
|
||||||
if (action == CURL_POLL_REMOVE) {
|
|
||||||
QLIST_REMOVE(socket, next);
|
|
||||||
g_free(socket);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +181,6 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
|
||||||
socket->state = state;
|
socket->state = state;
|
||||||
QLIST_INSERT_HEAD(&state->sockets, socket, next);
|
QLIST_INSERT_HEAD(&state->sockets, socket, next);
|
||||||
}
|
}
|
||||||
socket = NULL;
|
|
||||||
|
|
||||||
trace_curl_sock_cb(action, (int)fd);
|
trace_curl_sock_cb(action, (int)fd);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
@ -207,6 +202,11 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (action == CURL_POLL_REMOVE) {
|
||||||
|
QLIST_REMOVE(socket, next);
|
||||||
|
g_free(socket);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue