Changeset 72cf064 in mainline for uspace/srv/net/tcp/sock.c


Ignore:
Timestamp:
2012-08-13T17:17:04Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
33fee91
Parents:
f4a8734 (diff), 4820360 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tcp/sock.c

    rf4a8734 r72cf064  
    779779        }
    780780
     781        /* Grab recv_buffer_lock because of CV wait in tcp_sock_recv_fibril() */
     782        fibril_mutex_lock(&socket->recv_buffer_lock);
     783        socket->sock_core = NULL;
     784        fibril_mutex_unlock(&socket->recv_buffer_lock);
     785
    781786        rc = socket_destroy(NULL, socket_id, &client->sockets, &gsock,
    782787            tcp_free_sock_data);
     
    839844        log_msg(LVL_DEBUG, "tcp_sock_recv_fibril()");
    840845
     846        fibril_mutex_lock(&sock->recv_buffer_lock);
     847
    841848        while (true) {
    842849                log_msg(LVL_DEBUG, "call tcp_uc_receive()");
    843                 fibril_mutex_lock(&sock->recv_buffer_lock);
    844                 while (sock->recv_buffer_used != 0)
     850                while (sock->recv_buffer_used != 0 && sock->sock_core != NULL)
    845851                        fibril_condvar_wait(&sock->recv_buffer_cv,
    846852                            &sock->recv_buffer_lock);
     
    852858                        sock->recv_error = trc;
    853859                        fibril_condvar_broadcast(&sock->recv_buffer_cv);
    854                         fibril_mutex_unlock(&sock->recv_buffer_lock);
    855                         tcp_sock_notify_data(sock->sock_core);
     860                        if (sock->sock_core != NULL)
     861                                tcp_sock_notify_data(sock->sock_core);
    856862                        break;
    857863                }
     
    861867                sock->recv_buffer_used = data_len;
    862868                fibril_condvar_broadcast(&sock->recv_buffer_cv);
    863                 fibril_mutex_unlock(&sock->recv_buffer_lock);
    864                 tcp_sock_notify_data(sock->sock_core);
    865         }
     869                if (sock->sock_core != NULL)
     870                        tcp_sock_notify_data(sock->sock_core);
     871        }
     872
     873        fibril_mutex_unlock(&sock->recv_buffer_lock);
    866874
    867875        tcp_uc_delete(sock->conn);
Note: See TracChangeset for help on using the changeset viewer.