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;
}
|
|