Changes in uspace/srv/net/udp/assoc.c [3e6a98c5:69a93df7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/udp/assoc.c
r3e6a98c5 r69a93df7 36 36 37 37 #include <adt/list.h> 38 #include < stdbool.h>38 #include <bool.h> 39 39 #include <fibril_synch.h> 40 40 #include <io/log.h> … … 104 104 static void udp_assoc_free(udp_assoc_t *assoc) 105 105 { 106 log_msg(L OG_DEFAULT, LVL_DEBUG, "%s: udp_assoc_free(%p)", assoc->name, assoc);106 log_msg(LVL_DEBUG, "%s: udp_assoc_free(%p)", assoc->name, assoc); 107 107 108 108 while (!list_empty(&assoc->rcv_queue)) { … … 127 127 void udp_assoc_addref(udp_assoc_t *assoc) 128 128 { 129 log_msg(L OG_DEFAULT, LVL_DEBUG, "%s: upd_assoc_addref(%p)", assoc->name, assoc);129 log_msg(LVL_DEBUG, "%s: upd_assoc_addref(%p)", assoc->name, assoc); 130 130 atomic_inc(&assoc->refcnt); 131 131 } … … 139 139 void udp_assoc_delref(udp_assoc_t *assoc) 140 140 { 141 log_msg(L OG_DEFAULT, LVL_DEBUG, "%s: udp_assoc_delref(%p)", assoc->name, assoc);141 log_msg(LVL_DEBUG, "%s: udp_assoc_delref(%p)", assoc->name, assoc); 142 142 143 143 if (atomic_predec(&assoc->refcnt) == 0) … … 154 154 void udp_assoc_delete(udp_assoc_t *assoc) 155 155 { 156 log_msg(L OG_DEFAULT, LVL_DEBUG, "%s: udp_assoc_delete(%p)", assoc->name, assoc);156 log_msg(LVL_DEBUG, "%s: udp_assoc_delete(%p)", assoc->name, assoc); 157 157 158 158 assert(assoc->deleted == false); … … 192 192 void udp_assoc_set_foreign(udp_assoc_t *assoc, udp_sock_t *fsock) 193 193 { 194 log_msg(L OG_DEFAULT, LVL_DEBUG, "udp_assoc_set_foreign(%p, %p)", assoc, fsock);194 log_msg(LVL_DEBUG, "udp_assoc_set_foreign(%p, %p)", assoc, fsock); 195 195 fibril_mutex_lock(&assoc->lock); 196 196 assoc->ident.foreign = *fsock; … … 205 205 void udp_assoc_set_local(udp_assoc_t *assoc, udp_sock_t *lsock) 206 206 { 207 log_msg(L OG_DEFAULT, LVL_DEBUG, "udp_assoc_set_local(%p, %p)", assoc, lsock);207 log_msg(LVL_DEBUG, "udp_assoc_set_local(%p, %p)", assoc, lsock); 208 208 fibril_mutex_lock(&assoc->lock); 209 209 assoc->ident.local = *lsock; … … 228 228 int rc; 229 229 230 log_msg(L OG_DEFAULT, LVL_DEBUG, "udp_assoc_send(%p, %p, %p)",230 log_msg(LVL_DEBUG, "udp_assoc_send(%p, %p, %p)", 231 231 assoc, fsock, msg); 232 232 … … 261 261 udp_rcv_queue_entry_t *rqe; 262 262 263 log_msg(L OG_DEFAULT, LVL_DEBUG, "udp_assoc_recv()");263 log_msg(LVL_DEBUG, "udp_assoc_recv()"); 264 264 265 265 fibril_mutex_lock(&assoc->lock); 266 266 while (list_empty(&assoc->rcv_queue)) { 267 log_msg(L OG_DEFAULT, LVL_DEBUG, "udp_assoc_recv() - waiting");267 log_msg(LVL_DEBUG, "udp_assoc_recv() - waiting"); 268 268 fibril_condvar_wait(&assoc->rcv_queue_cv, &assoc->lock); 269 269 } 270 270 271 log_msg(L OG_DEFAULT, LVL_DEBUG, "udp_assoc_recv() - got a message");271 log_msg(LVL_DEBUG, "udp_assoc_recv() - got a message"); 272 272 link = list_first(&assoc->rcv_queue); 273 273 rqe = list_get_instance(link, udp_rcv_queue_entry_t, link); … … 291 291 int rc; 292 292 293 log_msg(L OG_DEFAULT, LVL_DEBUG, "udp_assoc_received(%p, %p)", rsp, msg);293 log_msg(LVL_DEBUG, "udp_assoc_received(%p, %p)", rsp, msg); 294 294 295 295 assoc = udp_assoc_find_ref(rsp); 296 296 if (assoc == NULL) { 297 log_msg(L OG_DEFAULT, LVL_DEBUG, "No association found. Message dropped.");297 log_msg(LVL_DEBUG, "No association found. Message dropped."); 298 298 /* XXX Generate ICMP error. */ 299 299 /* XXX Might propagate error directly by error return. */ … … 303 303 rc = udp_assoc_queue_msg(assoc, rsp, msg); 304 304 if (rc != EOK) { 305 log_msg(L OG_DEFAULT, LVL_DEBUG, "Out of memory. Message dropped.");305 log_msg(LVL_DEBUG, "Out of memory. Message dropped."); 306 306 /* XXX Generate ICMP error? */ 307 307 } … … 313 313 udp_rcv_queue_entry_t *rqe; 314 314 315 log_msg(L OG_DEFAULT, LVL_DEBUG, "udp_assoc_queue_msg(%p, %p, %p)",315 log_msg(LVL_DEBUG, "udp_assoc_queue_msg(%p, %p, %p)", 316 316 assoc, sp, msg); 317 317 … … 336 336 static bool udp_socket_match(udp_sock_t *sock, udp_sock_t *patt) 337 337 { 338 log_msg(L OG_DEFAULT, LVL_DEBUG, "udp_socket_match(sock=(%x,%u), pat=(%x,%u))",338 log_msg(LVL_DEBUG, "udp_socket_match(sock=(%x,%u), pat=(%x,%u))", 339 339 sock->addr.ipv4, sock->port, patt->addr.ipv4, patt->port); 340 340 … … 347 347 return false; 348 348 349 log_msg(L OG_DEFAULT, LVL_DEBUG, " -> match");349 log_msg(LVL_DEBUG, " -> match"); 350 350 351 351 return true; … … 355 355 static bool udp_sockpair_match(udp_sockpair_t *sp, udp_sockpair_t *pattern) 356 356 { 357 log_msg(L OG_DEFAULT, LVL_DEBUG, "udp_sockpair_match(%p, %p)", sp, pattern);357 log_msg(LVL_DEBUG, "udp_sockpair_match(%p, %p)", sp, pattern); 358 358 359 359 if (!udp_socket_match(&sp->local, &pattern->local)) … … 363 363 return false; 364 364 365 log_msg(L OG_DEFAULT, LVL_DEBUG, "Socket pair matched.");365 log_msg(LVL_DEBUG, "Socket pair matched."); 366 366 return true; 367 367 } … … 379 379 static udp_assoc_t *udp_assoc_find_ref(udp_sockpair_t *sp) 380 380 { 381 log_msg(L OG_DEFAULT, LVL_DEBUG, "udp_assoc_find_ref(%p)", sp);381 log_msg(LVL_DEBUG, "udp_assoc_find_ref(%p)", sp); 382 382 383 383 fibril_mutex_lock(&assoc_list_lock); … … 386 386 udp_assoc_t *assoc = list_get_instance(link, udp_assoc_t, link); 387 387 udp_sockpair_t *asp = &assoc->ident; 388 log_msg(L OG_DEFAULT, LVL_DEBUG, "compare with assoc (f:(%x,%u), l:(%x,%u))",388 log_msg(LVL_DEBUG, "compare with assoc (f:(%x,%u), l:(%x,%u))", 389 389 asp->foreign.addr.ipv4, asp->foreign.port, 390 390 asp->local.addr.ipv4, asp->local.port); … … 395 395 396 396 if (udp_sockpair_match(sp, asp)) { 397 log_msg(L OG_DEFAULT, LVL_DEBUG, "Returning assoc %p", assoc);397 log_msg(LVL_DEBUG, "Returning assoc %p", assoc); 398 398 udp_assoc_addref(assoc); 399 399 fibril_mutex_unlock(&assoc_list_lock);
Note:
See TracChangeset
for help on using the changeset viewer.