mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-09 04:19:10 -04:00
Try to untangle the logic in server_port_flush().
The logic that prevented the first loop in this function from being infinite was rather confusing and hard to follow. It seems to confuse some automatic analysis tools as well as me. Let's try to replace it with something more comprehensible.
This commit is contained in:
parent
361da8f202
commit
439aea0d07
7
evdns.c
7
evdns.c
@ -1418,9 +1418,9 @@ server_port_read(struct evdns_server_port *s) {
|
||||
static void
|
||||
server_port_flush(struct evdns_server_port *port)
|
||||
{
|
||||
struct server_request *req = port->pending_replies;
|
||||
ASSERT_LOCKED(port);
|
||||
while (port->pending_replies) {
|
||||
struct server_request *req = port->pending_replies;
|
||||
while (req) {
|
||||
int r = sendto(port->socket, req->response, req->response_len, 0,
|
||||
(struct sockaddr*) &req->addr, req->addrlen);
|
||||
if (r < 0) {
|
||||
@ -1432,6 +1432,9 @@ server_port_flush(struct evdns_server_port *port)
|
||||
if (server_request_free(req)) {
|
||||
/* we released the last reference to req->port. */
|
||||
return;
|
||||
} else {
|
||||
EVUTIL_ASSERT(req != port->pending_replies);
|
||||
req = port->pending_replies;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user