Changeset 36e2b55 in mainline


Ignore:
Timestamp:
2011-08-28T21:12:54Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8cc4ddb, c3d19ac
Parents:
19fc04c
Message:

Tear down data connections properly when terminating session.

File:
1 edited

Legend:

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

    r19fc04c r36e2b55  
    17771777int async_hangup(async_sess_t *sess)
    17781778{
     1779        async_exch_t *exch;
     1780       
    17791781        assert(sess);
    17801782       
    17811783        if (atomic_get(&sess->refcnt) > 0)
    17821784                return EBUSY;
     1785       
     1786        fibril_mutex_lock(&async_sess_mutex);
    17831787       
    17841788        int rc = async_hangup_internal(sess->phone);
    17851789        if (rc == EOK)
    17861790                free(sess);
     1791       
     1792        while (!list_empty(&sess->exch_list)) {
     1793                exch = (async_exch_t *)
     1794                    list_get_instance(list_first(&sess->exch_list),
     1795                    async_exch_t, sess_link);
     1796               
     1797                list_remove(&exch->sess_link);
     1798                list_remove(&exch->global_link);
     1799                async_hangup_internal(exch->phone);
     1800                free(exch);
     1801        }
     1802       
     1803        fibril_mutex_unlock(&async_sess_mutex);
    17871804       
    17881805        return rc;
Note: See TracChangeset for help on using the changeset viewer.