Browse Source

Merge pull request #502 from kery/free_connections

Fix the crash issue in free_connections
pull/515/head
Max Lv 9 years ago
parent
commit
d4268dd946
2 changed files with 4 additions and 8 deletions
  1. 6
      src/local.c
  2. 6
      src/server.c

6
src/local.c

@ -198,10 +198,8 @@ int create_and_bind(const char *addr, const char *port)
static void free_connections(struct ev_loop *loop)
{
struct cork_dllist_item *curr;
for (curr = cork_dllist_start(&connections);
!cork_dllist_is_end(&connections, curr);
curr = curr->next) {
struct cork_dllist_item *curr, *next;
cork_dllist_foreach_void (&connections, curr, next) {
server_t *server = cork_container_of(curr, server_t, entries);
remote_t *remote = server->remote;
close_and_free_server(loop, server);

6
src/server.c

@ -205,10 +205,8 @@ static void stat_update_cb(EV_P_ ev_timer *watcher, int revents)
static void free_connections(struct ev_loop *loop)
{
struct cork_dllist_item *curr;
for (curr = cork_dllist_start(&connections);
!cork_dllist_is_end(&connections, curr);
curr = curr->next) {
struct cork_dllist_item *curr, *next;
cork_dllist_foreach_void (&connections, curr, next) {
server_t *server = cork_container_of(curr, server_t, entries);
remote_t *remote = server->remote;
close_and_free_server(loop, server);

Loading…
Cancel
Save