OSSP CVS Repository

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

Check-in Number: 869
Date: 2001-Sep-05 21:58:44 (local)
2001-Sep-05 19:58:44 (UTC)
User:rse
Branch:
Comment: Perform the channel state tagging immediately for a channel and not afterwards. Functionality-wise this is the same, but semantically it is more clean.
Tickets:
Inspections:
Files:
ossp-pkg/l2/l2_channel.c      1.14 -> 1.15     10 inserted, 20 deleted

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

--- l2_channel.c 2001/09/05 13:56:12     1.14
+++ l2_channel.c 2001/09/05 19:58:44     1.15
@@ -70,25 +70,20 @@
 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;
-    chFirst = ch;
-    while (ch != NULL && ch->handler.open == NULL)
+    while (ch != NULL && ch->handler.open == NULL) {
+        ch->state = L2_CHSTATE_OPENED;
         ch = ch->downstream;
+    }
     if (ch == NULL)
         return L2_ERROR;
     rv = ch->handler.open(&ch->context, ch);
-    if (rv == L2_OK) {
-        ch = chFirst;
-        do {
-            ch->state = L2_CHSTATE_OPENED;
-            ch = ch->downstream;
-        } while (ch != NULL);
-    }
+    if (rv == L2_OK)
+        ch->state = L2_CHSTATE_OPENED;
     return rv;
 }
 
@@ -131,25 +126,20 @@
 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 == NULL)
+    while (ch != NULL && ch->handler.close == NULL) {
+        ch->state = L2_CHSTATE_CREATED;
         ch = ch->downstream;
+    }
     if (ch == NULL)
         return L2_ERROR;
     rv = ch->handler.close(&ch->context, ch);
-    if (rv == L2_OK) {
-        ch = chFirst;
-        do {
-            ch->state = L2_CHSTATE_CREATED;
-            ch = ch->downstream;
-        } while (ch != NULL);
-    }
+    if (rv == L2_OK)
+        ch->state = L2_CHSTATE_CREATED;
     return rv;
 }
 

CVSTrac 2.0.1