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