Changes in uspace/srv/net/tcp/sock.c [db81577:32d19f7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/sock.c
rdb81577 r32d19f7 114 114 *rsock = NULL; 115 115 116 sock = calloc( 1, sizeof(tcp_sockdata_t));116 sock = calloc(sizeof(tcp_sockdata_t), 1); 117 117 if (sock == NULL) 118 118 return ENOMEM; … … 277 277 278 278 socket->backlog = backlog; 279 socket->lconn = calloc( backlog, sizeof(tcp_conn_t *));279 socket->lconn = calloc(sizeof(tcp_conn_t *), backlog); 280 280 if (socket->lconn == NULL) { 281 281 fibril_mutex_unlock(&socket->lock); … … 293 293 for (i = 0; i < backlog; i++) { 294 294 295 lconn = calloc( 1, sizeof(tcp_sock_lconn_t));295 lconn = calloc(sizeof(tcp_sock_lconn_t), 1); 296 296 if (lconn == NULL) { 297 297 /* XXX Clean up */ … … 779 779 } 780 780 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 786 781 rc = socket_destroy(NULL, socket_id, &client->sockets, &gsock, 787 782 tcp_free_sock_data); … … 844 839 log_msg(LVL_DEBUG, "tcp_sock_recv_fibril()"); 845 840 846 fibril_mutex_lock(&sock->recv_buffer_lock);847 848 841 while (true) { 849 842 log_msg(LVL_DEBUG, "call tcp_uc_receive()"); 850 while (sock->recv_buffer_used != 0 && sock->sock_core != NULL) 843 fibril_mutex_lock(&sock->recv_buffer_lock); 844 while (sock->recv_buffer_used != 0) 851 845 fibril_condvar_wait(&sock->recv_buffer_cv, 852 846 &sock->recv_buffer_lock); … … 858 852 sock->recv_error = trc; 859 853 fibril_condvar_broadcast(&sock->recv_buffer_cv); 860 if (sock->sock_core != NULL)861 854 fibril_mutex_unlock(&sock->recv_buffer_lock); 855 tcp_sock_notify_data(sock->sock_core); 862 856 break; 863 857 } … … 867 861 sock->recv_buffer_used = data_len; 868 862 fibril_condvar_broadcast(&sock->recv_buffer_cv); 869 if (sock->sock_core != NULL) 870 tcp_sock_notify_data(sock->sock_core); 871 } 872 873 fibril_mutex_unlock(&sock->recv_buffer_lock); 863 fibril_mutex_unlock(&sock->recv_buffer_lock); 864 tcp_sock_notify_data(sock->sock_core); 865 } 874 866 875 867 tcp_uc_delete(sock->conn);
Note:
See TracChangeset
for help on using the changeset viewer.