Changes in uspace/srv/net/tcp/tqueue.c [c0f3460:7c15d6f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/tqueue.c
rc0f3460 r7c15d6f 1 1 /* 2 * Copyright (c) 201 1Jiri Svoboda2 * Copyright (c) 2015 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 62 62 { 63 63 tqueue->conn = conn; 64 tqueue->timer = fibril_timer_create( );64 tqueue->timer = fibril_timer_create(&conn->lock); 65 65 if (tqueue->timer == NULL) 66 66 return ENOMEM; … … 92 92 seg = tcp_segment_make_ctrl(ctrl); 93 93 tcp_tqueue_seg(conn, seg); 94 tcp_segment_delete(seg); 94 95 } 95 96 … … 212 213 213 214 tcp_tqueue_seg(conn, seg); 215 tcp_segment_delete(seg); 214 216 } 215 217 … … 280 282 } 281 283 282 void tcp_transmit_segment( tcp_sockpair_t *sp, tcp_segment_t *seg)284 void tcp_transmit_segment(inet_ep2_t *epp, tcp_segment_t *seg) 283 285 { 284 286 log_msg(LOG_DEFAULT, LVL_DEBUG, 285 "tcp_transmit_segment( f:(%u),l:(%u), %p)",286 sp->local.port, sp->foreign.port, seg);287 287 "tcp_transmit_segment(l:(%u),f:(%u), %p)", 288 epp->local.port, epp->remote.port, seg); 289 288 290 log_msg(LOG_DEFAULT, LVL_DEBUG, "SEG.SEQ=%" PRIu32 ", SEG.WND=%" PRIu32, 289 291 seg->seq, seg->wnd); … … 299 301 tcp_pdu_t *pdu; 300 302 301 if (tcp_pdu_encode( sp, seg, &pdu) != EOK) {303 if (tcp_pdu_encode(epp, seg, &pdu) != EOK) { 302 304 log_msg(LOG_DEFAULT, LVL_WARN, "Not enough memory. Segment dropped."); 303 305 return; … … 317 319 log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: retransmit_timeout_func(%p)", conn->name, conn); 318 320 319 fibril_mutex_lock(&conn->lock);321 tcp_conn_lock(conn); 320 322 321 323 if (conn->cstate == st_closed) { 322 324 log_msg(LOG_DEFAULT, LVL_DEBUG, "Connection already closed."); 323 fibril_mutex_unlock(&conn->lock);325 tcp_conn_unlock(conn); 324 326 tcp_conn_delref(conn); 325 327 return; … … 329 331 if (link == NULL) { 330 332 log_msg(LOG_DEFAULT, LVL_DEBUG, "Nothing to retransmit"); 331 fibril_mutex_unlock(&conn->lock);333 tcp_conn_unlock(conn); 332 334 tcp_conn_delref(conn); 333 335 return; … … 339 341 if (rt_seg == NULL) { 340 342 log_msg(LOG_DEFAULT, LVL_ERROR, "Memory allocation failed."); 341 fibril_mutex_unlock(&conn->lock);343 tcp_conn_unlock(conn); 342 344 tcp_conn_delref(conn); 343 345 /* XXX Handle properly */ … … 349 351 350 352 /* Reset retransmission timer */ 351 tcp_tqueue_timer_set(tqe->conn); 352 353 fibril_mutex_unlock(&conn->lock); 354 tcp_conn_delref(conn); 353 fibril_timer_set_locked(conn->retransmit.timer, RETRANSMIT_TIMEOUT, 354 retransmit_timeout_func, (void *) conn); 355 356 tcp_conn_unlock(conn); 357 358 log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: retransmit_timeout_func(%p) end", conn->name, conn); 355 359 } 356 360 … … 358 362 static void tcp_tqueue_timer_set(tcp_conn_t *conn) 359 363 { 360 log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_set() ", conn->name);364 log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_set() begin", conn->name); 361 365 362 366 /* Clear first to make sure we update refcnt correctly */ … … 364 368 365 369 tcp_conn_addref(conn); 366 fibril_timer_set (conn->retransmit.timer, RETRANSMIT_TIMEOUT,370 fibril_timer_set_locked(conn->retransmit.timer, RETRANSMIT_TIMEOUT, 367 371 retransmit_timeout_func, (void *) conn); 372 373 log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_set() end", conn->name); 368 374 } 369 375 … … 371 377 static void tcp_tqueue_timer_clear(tcp_conn_t *conn) 372 378 { 373 log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_clear() ", conn->name);374 375 if (fibril_timer_clear (conn->retransmit.timer) == fts_active)379 log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_clear() begin", conn->name); 380 381 if (fibril_timer_clear_locked(conn->retransmit.timer) == fts_active) 376 382 tcp_conn_delref(conn); 383 384 log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_clear() end", conn->name); 377 385 } 378 386
Note:
See TracChangeset
for help on using the changeset viewer.