Changeset 8d48c7e in mainline for uspace/srv/net/tcp/conn.c
- Timestamp:
- 2015-06-02T16:00:42Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c4bb828
- Parents:
- ab6326bc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/conn.c
rab6326bc r8d48c7e 199 199 void tcp_conn_addref(tcp_conn_t *conn) 200 200 { 201 log_msg(LOG_DEFAULT, LVL_DEBUG2, "%s: tcp_conn_addref(%p)", conn->name, conn); 201 log_msg(LOG_DEFAULT, LVL_DEBUG2, "%s: tcp_conn_addref(%p) before=%zu", 202 conn->name, conn, atomic_get(&conn->refcnt)); 202 203 atomic_inc(&conn->refcnt); 203 204 } … … 211 212 void tcp_conn_delref(tcp_conn_t *conn) 212 213 { 213 log_msg(LOG_DEFAULT, LVL_DEBUG2, "%s: tcp_conn_delref(%p)", conn->name, conn); 214 log_msg(LOG_DEFAULT, LVL_DEBUG2, "%s: tcp_conn_delref(%p) before=%zu", 215 conn->name, conn, atomic_get(&conn->refcnt)); 214 216 215 217 if (atomic_predec(&conn->refcnt) == 0) … … 269 271 tcp_conn_addref(conn); 270 272 fibril_mutex_lock(&conn_list_lock); 273 274 log_msg(LOG_DEFAULT, LVL_NOTE, "tcp_conn_add: conn=%p", conn); 271 275 272 276 rc = amap_insert(amap, &conn->ident, conn, af_allow_system, &aepp); … … 365 369 } 366 370 367 /** Match endpoint with pattern. */368 static bool tcp_ep_match(inet_ep_t *ep, inet_ep_t *patt)369 {370 log_msg(LOG_DEFAULT, LVL_DEBUG2,371 "tcp_ep_match(ep=(%u), pat=(%u))", ep->port, patt->port);372 373 if ((!inet_addr_is_any(&patt->addr)) &&374 (!inet_addr_compare(&patt->addr, &ep->addr)))375 return false;376 377 if ((patt->port != inet_port_any) &&378 (patt->port != ep->port))379 return false;380 381 log_msg(LOG_DEFAULT, LVL_DEBUG2, " -> match");382 383 return true;384 }385 386 /** Match endpoint pair with pattern. */387 static bool tcp_ep2_match(inet_ep2_t *epp, inet_ep2_t *pattern)388 {389 log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_ep2_match(%p, %p)", epp, pattern);390 391 if (!tcp_ep_match(&epp->local, &pattern->local))392 return false;393 394 if (!tcp_ep_match(&epp->remote, &pattern->remote))395 return false;396 397 return true;398 }399 400 371 /** Find connection structure for specified endpoint pair. 401 372 * … … 409 380 tcp_conn_t *tcp_conn_find_ref(inet_ep2_t *epp) 410 381 { 382 int rc; 383 void *arg; 384 tcp_conn_t *conn; 385 411 386 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_find_ref(%p)", epp); 412 387 413 log_msg(LOG_DEFAULT, LVL_DEBUG2, "compare conn (f:(%u), l:(%u))",414 epp->remote.port, epp->local.port);415 416 388 fibril_mutex_lock(&conn_list_lock); 417 389 418 list_foreach(conn_list, link, tcp_conn_t, conn) { 419 inet_ep2_t *cepp = &conn->ident; 420 421 log_msg(LOG_DEFAULT, LVL_DEBUG2, " - with (f:(%u), l:(%u))", 422 cepp->remote.port, cepp->local.port); 423 424 if (tcp_ep2_match(epp, cepp)) { 425 tcp_conn_addref(conn); 426 fibril_mutex_unlock(&conn_list_lock); 427 return conn; 428 } 429 } 390 rc = amap_find_match(amap, epp, &arg); 391 if (rc != EOK) { 392 assert(rc == ENOENT); 393 fibril_mutex_unlock(&conn_list_lock); 394 return NULL; 395 } 396 397 conn = (tcp_conn_t *)arg; 398 tcp_conn_addref(conn); 430 399 431 400 fibril_mutex_unlock(&conn_list_lock); 432 return NULL; 401 log_msg(LOG_DEFAULT, LVL_NOTE, "tcp_conn_find_ref: got conn=%p", 402 conn); 403 return conn; 433 404 } 434 405 … … 1209 1180 void tcp_conn_segment_arrived(tcp_conn_t *conn, tcp_segment_t *seg) 1210 1181 { 1211 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_segment_arrived(%p)", 1182 log_msg(LOG_DEFAULT, LVL_NOTE, "conn=%p", conn); 1183 log_msg(LOG_DEFAULT, LVL_NOTE, "conn->name=%p", conn->name); 1184 log_msg(LOG_DEFAULT, LVL_NOTE, "%s: tcp_conn_segment_arrived(%p)", 1212 1185 conn->name, seg); 1213 1186
Note:
See TracChangeset
for help on using the changeset viewer.