]> www.vanbest.org Git - sasc-ng.git/commitdiff
sasc: add nickb937's stability patches (partly)
authorleslie <unknown>
Tue, 22 Nov 2011 19:48:34 +0000 (20:48 +0100)
committerleslie <unknown>
Tue, 22 Nov 2011 19:48:34 +0000 (20:48 +0100)
contrib/sasc-ng/dvblb_plugins/plugin_cam.c
contrib/sasc-ng/dvblb_plugins/plugin_ffdecsa.c
contrib/sasc-ng/dvbloopback/src/msg_passing.c
contrib/sasc-ng/sc/sasccam.cpp

index db590fd878b70dd2032f917ecce5babcccbfdaf6..1b30b68f1e5b13839f36f4568993c20166dc6184 100644 (file)
@@ -260,6 +260,7 @@ void process_cam(struct msg *msg, unsigned int priority)
 
   if (sidmsg->calen == 0) {
     free_sidmsg(sidmsg);
+    msg->type = MSG_PROCESSED;
     return;
   }
   for(ch=Channels.First(); ch; ch=Channels.Next(ch)) {
@@ -280,6 +281,7 @@ void process_cam(struct msg *msg, unsigned int priority)
         }
       }
       free_sidmsg(sidmsg);
+      msg->type = MSG_PROCESSED;
       return;
     }
   } else {
index 030be27dc650532ecc5bb367b18c6dc8c4efb42a..254c4c25a6b2aad0579c0af20bc7af1ba9bc7362 100644 (file)
@@ -123,11 +123,13 @@ void update_keys(int adpt, unsigned char keytype, int index, unsigned char *key,
           pthread_mutex_unlock(&csa->state_lock);
           return;
         }
+        pthread_mutex_lock(&csa->keylock);
         if(! csa->keyindex[index].valid) {
           csa->keyindex[index].valid = 1;
           csa->keyindex[index].status = 0;
           csa->keyindex[index].queued = 0;
         }
+        pthread_mutex_unlock(&csa->keylock);
         pop_entry_from_queue_l(pid_ll, &pidmap_empty_queue, struct pid, &list_lock);
         pid_ll->pid = pid;
         pid_ll->index = index;
@@ -146,7 +148,9 @@ void update_keys(int adpt, unsigned char keytype, int index, unsigned char *key,
           ll_find_elem(pid_ll, csa->pid_map, index, index, struct pid);
           if(pid_ll == NULL) {
             //no valid pids on this index
+            pthread_mutex_lock(&csa->keylock);
             csa->keyindex[index].status = 0;
+            pthread_mutex_unlock(&csa->keylock);
             if(list_empty(&csa->pid_map)) {
               //state = ENCRYPTED_NOT_READY;
               csa->state = NOT_ENCRYPTED;
index 0f4b6374369aad30e8edc60b1676250c6b53c270..ccbc529f8957fcaad6dc523c0aa0bb1d65e8072f 100644 (file)
@@ -46,11 +46,16 @@ void msg_loop_init()
 {
   struct msgctrl *msgctrl;
   int priority;
+  int x;
   for (priority=0; priority <= MSG_HIGH_PRIORITY; priority++) {
     msgctrl = &message_control[priority];
     bzero(msgctrl, sizeof(struct msgctrl));
     INIT_LIST_HEAD(&msgctrl->msglist);
     INIT_LIST_HEAD(&msgctrl->empty_queue);
+    for (x = 0; x < 10; x++) {
+      struct msg *msg = (struct msg *)malloc(sizeof(struct msg));
+      list_add(&msg->list, &msgctrl->empty_queue);
+    }
     pthread_mutex_init(&msgctrl->mutex, NULL);
     pthread_cond_init(&msgctrl->cond, NULL);
   }
@@ -95,6 +100,8 @@ void * msg_loop(void * arg)
         list_del(&msg->list);
         break;
       }
+      if (!msg)
+        break;
       //If we've seen all elements on the queue, or the queue is empty,
       //we are done
       if(ptr == &msgctrl->msglist)
index 0704aa56f7eef4251ca78d68f3271db5d9fc0045..f10da7810e4bcae3e66a1b60d37c7d05712c33a9 100644 (file)
@@ -41,14 +41,14 @@ extern void _SetCaPid(int adapter, ca_pid_t *ca_pid);
 
 bool cScSascDevice::SetCaDescr(ca_descr_t *ca_descr, bool initial)
 {
-  printf("Called cScSascDevice::SetCaDescr\n");
+  //printf("Called cScSascDevice::SetCaDescr\n");
   _SetCaDescr(cardIndex,ca_descr);
   return true;
 }
 
 bool cScSascDevice::SetCaPid(ca_pid_t *ca_pid)
 {
-  printf("Called cScSascDevice::SetCaPid\n");
+  //printf("Called cScSascDevice::SetCaPid\n");
   _SetCaPid(cardIndex,ca_pid);
   return true;
 }