Debugs added.
authorPekka Riikonen <priikone@silcnet.org>
Tue, 4 Feb 2003 20:12:54 +0000 (20:12 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 4 Feb 2003 20:12:54 +0000 (20:12 +0000)
lib/silcutil/silcschedule.c

index 2a73c0da36c09b18b49d32cdf50bd2e6a4ae7047..a474d1651ce4c4b2cad15636a62b8b46d4462456 100644 (file)
@@ -720,9 +720,6 @@ SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
   if (!schedule->valid)
     return NULL;
 
-  SILC_LOG_DEBUG(("Registering new task, fd=%d type=%d priority=%d", fd, 
-                 type, priority));
-
   queue = SILC_SCHEDULE_GET_QUEUE(type);
     
   /* If the task is generic task, we check whether this task has already
@@ -731,6 +728,9 @@ SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
   if (type == SILC_TASK_GENERIC) {
     silc_mutex_lock(queue->lock);
 
+    SILC_LOG_DEBUG(("Registering new task, fd=%d type=%d priority=%d", fd, 
+                   type, priority));
+
     if (queue->task) {
       SilcTask task = queue->task;
       while(1) {
@@ -756,6 +756,12 @@ SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
   }
 
   newtask = silc_calloc(1, sizeof(*newtask));
+  if (!newtask)
+    return NULL;
+
+  SILC_LOG_DEBUG(("Registering new task %p, fd=%d type=%d priority=%d",
+                 newtask, fd, type, priority));
+
   newtask->fd = fd;
   newtask->context = context;
   newtask->callback = callback;
@@ -1225,7 +1231,7 @@ static int silc_schedule_task_remove(SilcTaskQueue queue, SilcTask task)
     return TRUE;
   }
 
-  SILC_LOG_DEBUG(("Removing task"));
+  SILC_LOG_DEBUG(("Removing task %p", task));
 
   /* Unregister the task */
   old = first;