Changeset 9f22213 in mainline for generic/src/ipc/ipcrsc.c


Ignore:
Timestamp:
2006-03-19T12:43:12Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7c7aae16
Parents:
b4b45210
Message:

More IPC stuff, added correct closing of connections from both sides.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/ipc/ipcrsc.c

    rb4b45210 r9f22213  
    7171 *   calls are answered, the phone is deallocated.
    7272 *
    73  * *** The answerbox hangs up (ipc_answer(ESLAM))
    74  * - The phone is disconnected. IPC_M_ANSWERBOX_HUNGUP notification
    75  *   is sent to source task, the calling process is expected to
     73 * *** The answerbox hangs up (ipc_answer(EHANGUP))
     74 * - The phone is disconnected. EHANGUP response code is sent
     75 *   to the calling process. All new calls through this phone
     76 *   get a EHUNGUP error code, the task is expected to
    7677 *   send an sys_ipc_hangup after cleaning up it's internal structures.
     78 *
     79 * Call forwarding
     80 *
     81 * The call can be forwarded, so that the answer to call is passed directly
     82 * to the original sender. However, this poses special problems regarding
     83 * routing of hangup messages.
     84 *
     85 * sys_ipc_hangup -> IPC_M_PHONE_HUNGUP
     86 * - this message CANNOT be forwarded
     87 *
     88 * EHANGUP during forward
     89 * - The *forwarding* phone will be closed, EFORWARD is sent to receiver.
     90 *
     91 * EHANGUP, ENOENT during forward
     92 * - EFORWARD is sent to the receiver, ipc_forward returns error code EFORWARD
    7793 *
    7894 * Cleanup strategy
    7995 *
    80  * 1) Disconnect all our phones ('sys_ipc_hangup')
     96 * 1) Disconnect all our phones ('ipc_phone_hangup').
    8197 *
    8298 * 2) Disconnect all phones connected to answerbox.
    83  *    * Send message 'PHONE_DISCONNECTED' to the target application
    84  * - Once all phones are disconnected, no further calls can arrive
    8599 *
    86100 * 3) Answer all messages in 'calls' and 'dispatched_calls' queues with
    87  *    appropriate error code.
     101 *    appropriate error code (EHANGUP, EFORWARD).
    88102 *
    89  * 4) Wait for all async answers to arrive
     103 * 4) Wait for all async answers to arrive.
    90104 *
    91105 */
     
    117131       
    118132        for (i=0; i < IPC_MAX_PHONES; i++) {
    119                 if (!TASK->phones[i].busy && !atomic_get(&TASK->phones[i].active_calls)) {
    120                         TASK->phones[i].busy = 1;
     133                if (TASK->phones[i].busy==IPC_BUSY_FREE && !atomic_get(&TASK->phones[i].active_calls)) {
     134                        TASK->phones[i].busy = IPC_BUSY_CONNECTING;
    121135                        break;
    122136                }
     
    137151        spinlock_lock(&TASK->lock);
    138152
    139         ASSERT(TASK->phones[phoneid].busy);
     153        ASSERT(TASK->phones[phoneid].busy == IPC_BUSY_CONNECTING);
    140154        ASSERT(! TASK->phones[phoneid].callee);
    141155
    142         TASK->phones[phoneid].busy = 0;
     156        TASK->phones[phoneid].busy = IPC_BUSY_FREE;
    143157        spinlock_unlock(&TASK->lock);
    144158}
     
    156170        phone_t *phone = &TASK->phones[phoneid];
    157171       
    158         ASSERT(phone->busy);
     172        ASSERT(phone->busy == IPC_BUSY_CONNECTING);
    159173        ipc_phone_connect(phone, box);
    160174}
Note: See TracChangeset for help on using the changeset viewer.