Changeset af2a76c in mainline for uspace/srv/net/tcp/tqueue.c


Ignore:
Timestamp:
2014-07-13T17:25:15Z (10 years ago)
Author:
Agnieszka Tabaka <nufcia@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7493e7b
Parents:
b8e75319 (diff), 78192cc7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tcp/tqueue.c

    rb8e75319 raf2a76c  
    5959static void tcp_tqueue_timer_clear(tcp_conn_t *conn);
    6060
     61#include <stdio.h>
    6162int tcp_tqueue_init(tcp_tqueue_t *tqueue, tcp_conn_t *conn)
    6263{
     64        printf("tcp_tqueue_init\n");
    6365        tqueue->conn = conn;
    64         tqueue->timer = fibril_timer_create();
     66        tqueue->timer = fibril_timer_create(&conn->lock);
    6567        if (tqueue->timer == NULL)
    6668                return ENOMEM;
     
    7880void tcp_tqueue_fini(tcp_tqueue_t *tqueue)
    7981{
     82        printf("tcp_tqueue_fini\n");
    8083        if (tqueue->timer != NULL) {
    8184                fibril_timer_destroy(tqueue->timer);
     
    9295        seg = tcp_segment_make_ctrl(ctrl);
    9396        tcp_tqueue_seg(conn, seg);
     97        tcp_segment_delete(seg);
    9498}
    9599
     
    212216
    213217        tcp_tqueue_seg(conn, seg);
     218        tcp_segment_delete(seg);
    214219}
    215220
     
    317322        log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: retransmit_timeout_func(%p)", conn->name, conn);
    318323
    319         fibril_mutex_lock(&conn->lock);
     324        tcp_conn_lock(conn);
    320325
    321326        if (conn->cstate == st_closed) {
    322327                log_msg(LOG_DEFAULT, LVL_DEBUG, "Connection already closed.");
    323                 fibril_mutex_unlock(&conn->lock);
     328                tcp_conn_unlock(conn);
    324329                tcp_conn_delref(conn);
    325330                return;
     
    329334        if (link == NULL) {
    330335                log_msg(LOG_DEFAULT, LVL_DEBUG, "Nothing to retransmit");
    331                 fibril_mutex_unlock(&conn->lock);
     336                tcp_conn_unlock(conn);
    332337                tcp_conn_delref(conn);
    333338                return;
     
    339344        if (rt_seg == NULL) {
    340345                log_msg(LOG_DEFAULT, LVL_ERROR, "Memory allocation failed.");
    341                 fibril_mutex_unlock(&conn->lock);
     346                tcp_conn_unlock(conn);
    342347                tcp_conn_delref(conn);
    343348                /* XXX Handle properly */
     
    351356        tcp_tqueue_timer_set(tqe->conn);
    352357
    353         fibril_mutex_unlock(&conn->lock);
     358        tcp_conn_unlock(conn);
    354359        tcp_conn_delref(conn);
     360
     361        log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: retransmit_timeout_func(%p) end", conn->name, conn);
    355362}
    356363
     
    358365static void tcp_tqueue_timer_set(tcp_conn_t *conn)
    359366{
    360         log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_set()", conn->name);
     367        log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_set() begin", conn->name);
    361368
    362369        /* Clear first to make sure we update refcnt correctly */
     
    364371
    365372        tcp_conn_addref(conn);
    366         fibril_timer_set(conn->retransmit.timer, RETRANSMIT_TIMEOUT,
     373        fibril_timer_set_locked(conn->retransmit.timer, RETRANSMIT_TIMEOUT,
    367374            retransmit_timeout_func, (void *) conn);
     375
     376        log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_set() end", conn->name);
    368377}
    369378
     
    371380static void tcp_tqueue_timer_clear(tcp_conn_t *conn)
    372381{
    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)
     382        log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_clear() begin", conn->name);
     383
     384        if (fibril_timer_clear_locked(conn->retransmit.timer) == fts_active)
    376385                tcp_conn_delref(conn);
     386
     387        log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_clear() end", conn->name);
    377388}
    378389
Note: See TracChangeset for help on using the changeset viewer.