Fixes a bug in locking code.

When multiple protocols have a lock for the same IP address, it crashes
under some circumstances.

Thanks to Matthias Schiffer for the bugreport.
This commit is contained in:
Ondrej Zajicek 2015-02-21 12:27:05 +01:00
parent dfc7a6c6a0
commit ab00639130

View file

@ -70,7 +70,7 @@ olock_free(resource *r)
DBG("olock: -> %p becomes locked\n", n); DBG("olock: -> %p becomes locked\n", n);
q = SKIP_BACK(struct object_lock, n, n); q = SKIP_BACK(struct object_lock, n, n);
rem_node(n); rem_node(n);
add_tail_list(&l->waiters, &q->waiters); add_tail_list(&q->waiters, &l->waiters);
q->state = OLOCK_STATE_EVENT; q->state = OLOCK_STATE_EVENT;
add_head(&olock_list, n); add_head(&olock_list, n);
ev_schedule(olock_event); ev_schedule(olock_event);