Changeset 141a20d in mainline for uspace/srv/net/udp/assoc.c


Ignore:
Timestamp:
2012-08-13T10:40:17Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1e2df13
Parents:
e5e73af
Message:

Terminate UDP receive fibril when socket is closed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/udp/assoc.c

    re5e73af r141a20d  
    264264
    265265        fibril_mutex_lock(&assoc->lock);
    266         while (list_empty(&assoc->rcv_queue)) {
     266        while (list_empty(&assoc->rcv_queue) && !assoc->reset) {
    267267                log_msg(LVL_DEBUG, "udp_assoc_recv() - waiting");
    268268                fibril_condvar_wait(&assoc->rcv_queue_cv, &assoc->lock);
     269        }
     270
     271        if (assoc->reset) {
     272                log_msg(LVL_DEBUG, "udp_assoc_recv() - association was reset");
     273                fibril_mutex_unlock(&assoc->lock);
     274                return ECONNABORTED;
    269275        }
    270276
     
    308314}
    309315
     316/** Reset association.
     317 *
     318 * This causes any pendingreceive operations to return immediately with
     319 * UDP_ERESET.
     320 */
     321void udp_assoc_reset(udp_assoc_t *assoc)
     322{
     323        fibril_mutex_lock(&assoc->lock);
     324        assoc->reset = true;
     325        fibril_condvar_broadcast(&assoc->rcv_queue_cv);
     326        fibril_mutex_unlock(&assoc->lock);
     327}
     328
    310329static int udp_assoc_queue_msg(udp_assoc_t *assoc, udp_sockpair_t *sp,
    311330    udp_msg_t *msg)
Note: See TracChangeset for help on using the changeset viewer.