OSSP CVS Repository

ossp - Check-in [863]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 863
Date: 2001-Sep-05 15:56:12 (local)
2001-Sep-05 13:56:12 (UTC)
User:rse
Branch:
Comment: Bugfix channel API: L2_OK -> NULL, states have to be remembered for all channels in a stack, not just the last found one.
Tickets:
Inspections:
Files:
ossp-pkg/l2/l2_channel.c      1.13 -> 1.14     23 inserted, 9 deleted

ossp-pkg/l2/l2_channel.c 1.13 -> 1.14

--- l2_channel.c 2001/09/05 10:59:37     1.13
+++ l2_channel.c 2001/09/05 13:56:12     1.14
@@ -70,18 +70,25 @@
 l2_result_t l2_channel_open(l2_channel_t *ch)
 {
     l2_result_t rv;
+    l2_channel_t *chFirst;
 
     if (ch == NULL)
         return L2_ERROR;
     if (ch->state != L2_CHSTATE_CREATED)
         return L2_ERROR;
-    while (ch != NULL && ch->handler.open == L2_OK)
+    chFirst = ch;
+    while (ch != NULL && ch->handler.open == NULL)
         ch = ch->downstream;
     if (ch == NULL)
         return L2_ERROR;
     rv = ch->handler.open(&ch->context, ch);
-    if (rv == L2_OK)
-        ch->state = L2_CHSTATE_OPENED;
+    if (rv == L2_OK) {
+        ch = chFirst;
+        do {
+            ch->state = L2_CHSTATE_OPENED;
+            ch = ch->downstream;
+        } while (ch != NULL);
+    }
     return rv;
 }
 
@@ -97,7 +104,7 @@
         return L2_ERROR;
     if (bufsize == 0)
         return L2_OK;
-    while (ch != NULL && ch->handler.write == L2_OK)
+    while (ch != NULL && ch->handler.write == NULL)
         ch = ch->downstream;
     if (ch == NULL)
         return L2_ERROR;
@@ -113,7 +120,7 @@
         return L2_ERROR;
     if (ch->state != L2_CHSTATE_OPENED)
         return L2_ERROR;
-    while (ch != NULL && ch->handler.flush == L2_OK)
+    while (ch != NULL && ch->handler.flush == NULL)
         ch = ch->downstream;
     if (ch == NULL)
         return L2_ERROR;
@@ -124,18 +131,25 @@
 l2_result_t l2_channel_close(l2_channel_t *ch)
 {
     l2_result_t rv;
+    l2_channel_t *chFirst;
 
     if (ch == NULL)
         return L2_ERROR;
+    chFirst = ch;
     if (ch->state != L2_CHSTATE_OPENED)
         return L2_ERROR;
-    while (ch != NULL && ch->handler.close == L2_OK)
+    while (ch != NULL && ch->handler.close == NULL)
         ch = ch->downstream;
     if (ch == NULL)
         return L2_ERROR;
     rv = ch->handler.close(&ch->context, ch);
-    if (rv == L2_OK)
-        ch->state = L2_CHSTATE_CREATED;
+    if (rv == L2_OK) {
+        ch = chFirst;
+        do {
+            ch->state = L2_CHSTATE_CREATED;
+            ch = ch->downstream;
+        } while (ch != NULL);
+    }
     return rv;
 }
 
@@ -148,7 +162,7 @@
     if (ch->state == L2_CHSTATE_OPENED)
         if ((rv = l2_channel_close(ch)) != L2_OK)
             return rv;
-    while (ch != NULL && ch->handler.destroy == L2_OK)
+    while (ch != NULL && ch->handler.destroy == NULL)
         ch = ch->downstream;
     if (ch != NULL)
         rv = ch->handler.destroy(&ch->context, ch);

CVSTrac 2.0.1