Changes in / [289cb7dd:25eec4e] in mainline
- Files:
-
- 14 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r289cb7dd r25eec4e 112 112 $(USPACE_PATH)/srv/hid/remcons/remcons \ 113 113 $(USPACE_PATH)/srv/hid/isdv4_tablet/isdv4_tablet \ 114 $(USPACE_PATH)/srv/net/dnsres/dnsres \ 114 115 $(USPACE_PATH)/srv/net/ethip/ethip \ 115 116 $(USPACE_PATH)/srv/net/inetsrv/inetsrv \ -
uspace/Makefile
r289cb7dd r25eec4e 82 82 srv/devman \ 83 83 srv/loader \ 84 srv/net/dnsres \ 84 85 srv/net/ethip \ 85 86 srv/net/inetsrv \ -
uspace/srv/net/inetsrv/addrobj.c
r289cb7dd r25eec4e 221 221 222 222 lsrc_addr.ipv4 = addr->naddr.ipv4; 223 ldest_addr = &dgram->dest;223 ldest_addr = ldest; 224 224 225 225 return inet_link_send_dgram(addr->ilink, &lsrc_addr, ldest_addr, dgram, -
uspace/srv/net/inetsrv/inetsrv.c
r289cb7dd r25eec4e 98 98 } 99 99 100 rc = inet_link_discovery_start(); 100 inet_sroute_t *sroute = inet_sroute_new(); 101 if (sroute == NULL) { 102 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed creating default route (%d).", rc); 103 return ENOMEM; 104 } 105 106 sroute->dest.ipv4 = 0; 107 sroute->dest.bits = 0; 108 sroute->router.ipv4 = (192 << 24) | (168 << 16) | (0 << 8) | 1; 109 sroute->name = str_dup("default"); 110 inet_sroute_add(sroute); 111 112 rc = inet_link_discovery_start(); 101 113 if (rc != EOK) 102 114 return EEXIST; -
uspace/srv/net/udp/assoc.c
r289cb7dd r25eec4e 279 279 280 280 fibril_mutex_lock(&assoc->lock); 281 while (list_empty(&assoc->rcv_queue) ) {281 while (list_empty(&assoc->rcv_queue) && !assoc->reset) { 282 282 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv() - waiting"); 283 283 fibril_condvar_wait(&assoc->rcv_queue_cv, &assoc->lock); 284 } 285 286 if (assoc->reset) { 287 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv() - association was reset"); 288 fibril_mutex_unlock(&assoc->lock); 289 return ECONNABORTED; 284 290 } 285 291 … … 323 329 } 324 330 331 /** Reset association. 332 * 333 * This causes any pendingreceive operations to return immediately with 334 * UDP_ERESET. 335 */ 336 void udp_assoc_reset(udp_assoc_t *assoc) 337 { 338 fibril_mutex_lock(&assoc->lock); 339 assoc->reset = true; 340 fibril_condvar_broadcast(&assoc->rcv_queue_cv); 341 fibril_mutex_unlock(&assoc->lock); 342 } 343 325 344 static int udp_assoc_queue_msg(udp_assoc_t *assoc, udp_sockpair_t *sp, 326 345 udp_msg_t *msg) -
uspace/srv/net/udp/assoc.h
r289cb7dd r25eec4e 51 51 extern int udp_assoc_recv(udp_assoc_t *, udp_msg_t **, udp_sock_t *); 52 52 extern void udp_assoc_received(udp_sockpair_t *, udp_msg_t *); 53 53 extern void udp_assoc_reset(udp_assoc_t *); 54 54 55 55 #endif -
uspace/srv/net/udp/sock.c
r289cb7dd r25eec4e 537 537 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_sock_close()"); 538 538 int socket_id = SOCKET_GET_SOCKET_ID(call); 539 539 540 540 socket_core_t *sock_core = 541 541 socket_cores_find(&client->sockets, socket_id); … … 544 544 return; 545 545 } 546 546 547 547 udp_sockdata_t *socket = 548 548 (udp_sockdata_t *) sock_core->specific_data; 549 549 fibril_mutex_lock(&socket->lock); 550 550 551 fibril_mutex_lock(&socket->recv_buffer_lock); 552 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_close - set socket->sock_core = NULL"); 553 socket->sock_core = NULL; 554 fibril_mutex_unlock(&socket->recv_buffer_lock); 555 556 udp_uc_reset(socket->assoc); 557 551 558 int rc = socket_destroy(NULL, socket_id, &client->sockets, &gsock, 552 559 udp_free_sock_data); 553 560 if (rc != EOK) { 561 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_close - socket_destroy failed"); 554 562 fibril_mutex_unlock(&socket->lock); 555 563 async_answer_0(callid, rc); 556 564 return; 557 565 } 558 566 567 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_close - broadcast recv_buffer_cv"); 568 fibril_condvar_broadcast(&socket->recv_buffer_cv); 569 559 570 fibril_mutex_unlock(&socket->lock); 560 571 async_answer_0(callid, EOK); … … 582 593 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_recv_fibril()"); 583 594 595 fibril_mutex_lock(&sock->recv_buffer_lock); 596 584 597 while (true) { 585 598 log_msg(LOG_DEFAULT, LVL_DEBUG, "[] wait for rcv buffer empty()"); 586 fibril_mutex_lock(&sock->recv_buffer_lock); 587 while (sock->recv_buffer_used != 0) { 599 while (sock->recv_buffer_used != 0 && sock->sock_core != NULL) { 588 600 fibril_condvar_wait(&sock->recv_buffer_cv, 589 601 &sock->recv_buffer_lock); … … 594 606 UDP_FRAGMENT_SIZE, &rcvd, &xflags, &sock->recv_fsock); 595 607 sock->recv_error = urc; 608 609 log_msg(LOG_DEFAULT, LVL_DEBUG, "[] udp_uc_receive -> %d", urc); 610 611 if (sock->sock_core != NULL) 612 udp_sock_notify_data(sock->sock_core); 613 596 614 597 615 udp_sock_notify_data(sock->sock_core); 598 616 599 617 if (urc != UDP_EOK) { 618 log_msg(LOG_DEFAULT, LVL_DEBUG, "[] urc != UDP_EOK, break"); 600 619 fibril_condvar_broadcast(&sock->recv_buffer_cv); 601 fibril_mutex_unlock(&sock->recv_buffer_lock);602 620 break; 603 621 } … … 606 624 607 625 sock->recv_buffer_used = rcvd; 608 fibril_mutex_unlock(&sock->recv_buffer_lock);609 626 fibril_condvar_broadcast(&sock->recv_buffer_cv); 610 627 } 611 628 629 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_recv_fibril() exited loop"); 630 fibril_mutex_unlock(&sock->recv_buffer_lock); 612 631 udp_uc_destroy(sock->assoc); 632 633 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_recv_fibril() terminated"); 613 634 614 635 return 0; -
uspace/srv/net/udp/ucall.c
r289cb7dd r25eec4e 113 113 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: udp_uc_receive()", assoc->name); 114 114 rc = udp_assoc_recv(assoc, &msg, fsock); 115 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv -> %d", rc); 115 116 switch (rc) { 117 case EOK: 118 break; 119 case ECONNABORTED: 120 return UDP_ERESET; 121 default: 122 assert(false); 116 123 } 117 124 … … 133 140 { 134 141 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_uc_destroy()"); 142 udp_assoc_reset(assoc); 135 143 udp_assoc_remove(assoc); 136 144 udp_assoc_delete(assoc); 145 } 146 147 void udp_uc_reset(udp_assoc_t *assoc) 148 { 149 udp_assoc_reset(assoc); 137 150 } 138 151 -
uspace/srv/net/udp/ucall.h
r289cb7dd r25eec4e 49 49 extern void udp_uc_status(udp_assoc_t *, udp_assoc_status_t *); 50 50 extern void udp_uc_destroy(udp_assoc_t *); 51 extern void udp_uc_reset(udp_assoc_t *); 51 52 52 53 #endif -
uspace/srv/net/udp/udp_type.h
r289cb7dd r25eec4e 51 51 UDP_EUNSPEC, 52 52 /* No route to destination */ 53 UDP_ENOROUTE 53 UDP_ENOROUTE, 54 /** Association reset by user */ 55 UDP_ERESET 54 56 } udp_error_t; 55 57 … … 119 121 udp_sockpair_t ident; 120 122 123 /** True if association was reset by user */ 124 bool reset; 125 121 126 /** True if association was deleted by user */ 122 127 bool deleted;
Note:
See TracChangeset
for help on using the changeset viewer.