diff options
author | Patrick McHardy <kaber@trash.net> | 2010-07-30 03:34:36 +0200 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2010-07-30 03:40:54 +0200 |
commit | 333318291996defc22eab281b11fa1d9f5f85985 (patch) | |
tree | 016a0b4d070fc2b8da18616aa2a652c11cbafc8e | |
parent | 158e5c8a98919a510942888af8a00bc39db0ed8f (diff) |
lce: close page transaction after first message was received and on link shutdown
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r-- | src/lce.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -670,6 +670,16 @@ static void dect_lce_data_link_event(struct dect_handle *dh, if (events & DECT_FD_READ) { dect_ddl_rcv_msg(dh, ddl); + + /* Close the page transaction after receiving the first + * message, which is expected to initiate a higher layer + * protocol transaction or reject the page response. + */ + if (dh->page_transaction.state == DECT_TRANSACTION_OPEN) { + dect_debug(DECT_DEBUG_LCE, "\n"); + dect_close_transaction(dh, &dh->page_transaction, + DECT_RELEASE_NORMAL); + } } } @@ -988,12 +998,20 @@ static void dect_lce_open(struct dect_handle *dh, } } +static void dect_lce_shutdown(struct dect_handle *dh, + struct dect_transaction *ta) +{ + lce_debug("shutdown page transaction"); + dect_close_transaction(dh, ta, DECT_DDL_RELEASE_NORMAL); +} + static const struct dect_nwk_protocol lce_protocol = { .name = "Link Control", .pd = DECT_PD_LCE, .max_transactions = 1, .open = dect_lce_open, .rcv = dect_lce_rcv, + .shutdown = dect_lce_shutdown, }; /* @@ -1147,6 +1165,8 @@ int dect_lce_init(struct dect_handle *dh) if (dect_register_fd(dh, dh->s_sap, DECT_FD_READ) < 0) goto err4; + dh->page_transaction.state = DECT_TRANSACTION_CLOSED; + dect_lce_register_protocol(&lce_protocol); return 0; |