Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/async_sess.c

    r8b5c8ae r8cd21d16  
    110110typedef struct {
    111111        link_t sess_link;       /**< Link for the session list of inactive connections. */
    112         link_t global_link;     /**< Link for the global list of inactive connections. */
     112        link_t global_link;     /**< Link for the global list of inactive connectinos. */
    113113        int data_phone;         /**< Connected data phone. */
    114114} conn_node_t;
    115115
    116116/**
    117  * Mutex protecting the inactive_conn_head list, the session list and the
    118  * avail_phone condition variable.
     117 * Mutex protecting the inactive_conn_head list and the session list.
    119118 */
    120119static fibril_mutex_t async_sess_mutex;
     
    129128 */
    130129static LIST_INITIALIZE(session_list_head);
    131 
    132 /**
    133  * Condition variable used to wait for a phone to become available.
    134  */
    135 static FIBRIL_CONDVAR_INITIALIZE(avail_phone_cv);
    136130
    137131/** Initialize the async_sess subsystem.
     
    156150 * @param sess  Session structure provided by caller, will be filled in.
    157151 * @param phone Phone connected to the desired server task.
    158  * @param arg1  Value to pass as first argument upon creating a new
    159  *              connection. Typical use is to identify a resource within
    160  *              the server that the caller wants to access (port ID,
    161  *              interface ID, device ID, etc.).
    162  */
    163 void async_session_create(async_sess_t *sess, int phone, sysarg_t arg1)
     152 */
     153void async_session_create(async_sess_t *sess, int phone)
    164154{
    165155        sess->sess_phone = phone;
    166         sess->connect_arg1 = arg1;
    167156        list_initialize(&sess->conn_head);
    168157       
     
    203192                free(conn);
    204193        }
    205        
    206         fibril_condvar_broadcast(&avail_phone_cv);
    207194}
    208195
     
    244231                 */
    245232retry:
    246                 data_phone = async_connect_me_to(sess->sess_phone,
    247                     sess->connect_arg1, 0, 0);
     233                data_phone = async_connect_me_to(sess->sess_phone, 0, 0, 0);
    248234                if (data_phone >= 0) {
    249235                        /* success, do nothing */
     
    264250                } else {
    265251                        /*
    266                          * Wait for a phone to become available.
     252                         * This is unfortunate. We failed both to find a cached
     253                         * connection or to create a new one even after cleaning up
     254                         * the cache. This is most likely due to too many
     255                         * open sessions (connected session phones).
    267256                         */
    268                         fibril_condvar_wait(&avail_phone_cv, &async_sess_mutex);
    269                         goto retry;
     257                        data_phone = ELIMIT;
    270258                }
    271259        }
     
    285273
    286274        fibril_mutex_lock(&async_sess_mutex);
    287         fibril_condvar_signal(&avail_phone_cv);
    288275        conn = (conn_node_t *) malloc(sizeof(conn_node_t));
    289276        if (!conn) {
     
    292279                 * means that we simply hang up.
    293280                 */
     281                fibril_mutex_unlock(&async_sess_mutex);
    294282                ipc_hangup(data_phone);
    295                 fibril_mutex_unlock(&async_sess_mutex);
    296283                return;
    297284        }
Note: See TracChangeset for help on using the changeset viewer.