Changeset 1f2b07a in mainline
- Timestamp:
- 2015-06-08T22:00:22Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dc0d6e5d
- Parents:
- 204ba47
- Location:
- uspace
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/inet/tcp.c
r204ba47 r1f2b07a 81 81 list_initialize(&tcp->conn); 82 82 list_initialize(&tcp->listener); 83 fibril_mutex_initialize(&tcp->lock); 84 fibril_condvar_initialize(&tcp->cv); 83 85 84 86 rc = loc_service_get_id(SERVICE_NAME_TCP, &tcp_svcid, … … 115 117 116 118 async_hangup(tcp->sess); 119 120 fibril_mutex_lock(&tcp->lock); 121 while (!tcp->cb_done) 122 fibril_condvar_wait(&tcp->cv, &tcp->lock); 123 fibril_mutex_unlock(&tcp->lock); 124 117 125 free(tcp); 118 126 } … … 593 601 594 602 if (!IPC_GET_IMETHOD(call)) { 595 /* TODO: Handle hangup*/596 return;603 /* Hangup*/ 604 goto out; 597 605 } 598 606 … … 621 629 } 622 630 } 631 out: 632 fibril_mutex_lock(&tcp->lock); 633 tcp->cb_done = true; 634 fibril_mutex_unlock(&tcp->lock); 635 fibril_condvar_broadcast(&tcp->cv); 623 636 } 624 637 -
uspace/lib/c/generic/inet/udp.c
r204ba47 r1f2b07a 73 73 74 74 list_initialize(&udp->assoc); 75 fibril_mutex_initialize(&udp->lock); 76 fibril_condvar_initialize(&udp->cv); 75 77 76 78 rc = loc_service_get_id(SERVICE_NAME_UDP, &udp_svcid, … … 107 109 108 110 async_hangup(udp->sess); 111 112 fibril_mutex_lock(&udp->lock); 113 while (!udp->cb_done) 114 fibril_condvar_wait(&udp->cv, &udp->lock); 115 fibril_mutex_unlock(&udp->lock); 116 109 117 free(udp); 110 118 } … … 343 351 344 352 if (!IPC_GET_IMETHOD(call)) { 345 /* TODO: Handle hangup */346 return;353 /* Hangup */ 354 goto out; 347 355 } 348 356 … … 356 364 } 357 365 } 366 out: 367 fibril_mutex_lock(&udp->lock); 368 udp->cb_done = true; 369 fibril_mutex_unlock(&udp->lock); 370 fibril_condvar_broadcast(&udp->cv); 358 371 } 359 372 -
uspace/lib/c/include/inet/tcp.h
r204ba47 r1f2b07a 90 90 /** List of listeners */ 91 91 list_t listener; /* of tcp_listener_t */ 92 /** TCP service lock */ 93 fibril_mutex_t lock; 94 /** For waiting on cb_done */ 95 fibril_condvar_t cv; 96 /** Set to @a true when callback connection handler has terminated */ 97 bool cb_done; 92 98 } tcp_t; 93 99 -
uspace/lib/c/include/inet/udp.h
r204ba47 r1f2b07a 37 37 38 38 #include <async.h> 39 #include <fibril_synch.h> 39 40 #include <inet/addr.h> 40 41 #include <inet/endpoint.h> 41 42 #include <inet/inet.h> 43 #include <stdbool.h> 42 44 43 45 /** UDP link state */ … … 81 83 /** List of associations */ 82 84 list_t assoc; /* of udp_assoc_t */ 85 /** UDP service lock */ 86 fibril_mutex_t lock; 87 /** For waiting on cb_done */ 88 fibril_condvar_t cv; 89 /** Set to @a true when callback connection handler has terminated */ 90 bool cb_done; 83 91 } udp_t; 84 92 -
uspace/srv/net/tcp/service.c
r204ba47 r1f2b07a 886 886 /* XXX Destroy listeners */ 887 887 } 888 889 if (client->sess != NULL) 890 async_hangup(client->sess); 888 891 } 889 892 -
uspace/srv/net/udp/service.c
r204ba47 r1f2b07a 490 490 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_client_conn()"); 491 491 492 client.sess = NULL; 492 493 list_initialize(&client.cassoc); 493 494 list_initialize(&client.crcv_queue); … … 545 546 546 547 /* XXX Clean up client receive queue */ 548 549 if (client.sess != NULL) 550 async_hangup(client.sess); 547 551 } 548 552
Note:
See TracChangeset
for help on using the changeset viewer.