request = (struct GNUNET_LOCKMANAGER_Message *) message;
domain_name = (const char *) &request[1];
msize -= sizeof (struct GNUNET_LOCKMANAGER_Message);
- if ('\0' != domain_name[msize])
+ if ('\0' != domain_name[msize - 1])
{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Bad domain `%.*s' - byte with index %u is %X, not 0.\n", msize,
+ domain_name, msize - 1, (unsigned int) domain_name[msize - 1]);
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
{
if (lock->cl_entry == cl_entry)
{ /* Client is requesting a lock it already owns */
- GNUNET_break (0);
+ GNUNET_break_op (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
lock->cl_entry = wl_entry->cl_entry;
lock_wl_remove (lock, wl_entry);
send_success_msg (lock->cl_entry->client, lock->domain_name, lock->lock_num);
- return;
}
struct ClientList *cl_entry;
struct LockList *ll_entry;
struct Lock *lock;
+ struct WaitList *wl_entry;
if (NULL == client)
return;
{
lock = ll_entry->lock;
cl_ll_remove_lock (cl_entry, ll_entry);
- process_lock_release (lock);
+ if (lock->cl_entry == cl_entry)
+ process_lock_release (lock);
+ else
+ {
+ wl_entry = lock_wl_find (lock, cl_entry);
+ GNUNET_assert (NULL != wl_entry);
+ lock_wl_remove (lock, wl_entry);
+ }
}
cl_remove_client (cl_entry);
}
GNUNET_CONTAINER_multihashmap_iterate (lock_map, &lock_delete_iterator, NULL);
GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap_size (lock_map));
GNUNET_CONTAINER_multihashmap_destroy (lock_map);
+ lock_map = NULL;
}
};
GNUNET_SERVER_add_handlers (server, message_handlers);
GNUNET_SERVER_disconnect_notify (server, &client_disconnect_cb, NULL);
- lock_map = GNUNET_CONTAINER_multihashmap_create (30);
+ lock_map = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO);
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
NULL);
}