Changeset 15d0046 in mainline for uspace/srv/net/tcp/ucall.c


Ignore:
Timestamp:
2014-09-12T13:22:33Z (10 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9b20126
Parents:
8db09e4 (diff), 105d8d6 (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/ucall.c

    r8db09e4 r15d0046  
    9090        /* Wait for connection to be established or reset */
    9191        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open: Wait for connection.");
    92         fibril_mutex_lock(&nconn->lock);
     92        tcp_conn_lock(nconn);
    9393        while (nconn->cstate == st_listen ||
    9494            nconn->cstate == st_syn_sent ||
     
    100100                log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open: Connection was reset.");
    101101                assert(nconn->cstate == st_closed);
    102                 fibril_mutex_unlock(&nconn->lock);
     102                tcp_conn_unlock(nconn);
    103103                return TCP_ERESET;
    104104        }
    105105
    106         fibril_mutex_unlock(&nconn->lock);
     106        tcp_conn_unlock(nconn);
    107107        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open: Connection was established.");
    108108
     
    121121        log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_uc_send()", conn->name);
    122122
    123         fibril_mutex_lock(&conn->lock);
     123        tcp_conn_lock(conn);
    124124
    125125        if (conn->cstate == st_closed) {
    126                 fibril_mutex_unlock(&conn->lock);
     126                tcp_conn_unlock(conn);
    127127                return TCP_ENOTEXIST;
    128128        }
     
    135135
    136136        if (conn->snd_buf_fin) {
    137                 fibril_mutex_unlock(&conn->lock);
     137                tcp_conn_unlock(conn);
    138138                return TCP_ECLOSING;
    139139        }
     
    149149
    150150                if (conn->reset) {
    151                         fibril_mutex_unlock(&conn->lock);
     151                        tcp_conn_unlock(conn);
    152152                        return TCP_ERESET;
    153153                }
     
    165165
    166166        tcp_tqueue_new_data(conn);
    167         fibril_mutex_unlock(&conn->lock);
     167        tcp_conn_unlock(conn);
    168168
    169169        return TCP_EOK;
     
    178178        log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_uc_receive()", conn->name);
    179179
    180         fibril_mutex_lock(&conn->lock);
     180        tcp_conn_lock(conn);
    181181
    182182        if (conn->cstate == st_closed) {
    183                 fibril_mutex_unlock(&conn->lock);
     183                tcp_conn_unlock(conn);
    184184                return TCP_ENOTEXIST;
    185185        }
     
    197197                if (conn->rcv_buf_fin) {
    198198                        /* End of data, peer closed connection */
    199                         fibril_mutex_unlock(&conn->lock);
     199                        tcp_conn_unlock(conn);
    200200                        return TCP_ECLOSING;
    201201                } else {
    202202                        /* Connection was reset */
    203203                        assert(conn->reset);
    204                         fibril_mutex_unlock(&conn->lock);
     204                        tcp_conn_unlock(conn);
    205205                        return TCP_ERESET;
    206206                }
     
    227227            conn->name, xfer_size);
    228228
    229         fibril_mutex_unlock(&conn->lock);
     229        tcp_conn_unlock(conn);
    230230
    231231        return TCP_EOK;
     
    238238            conn);
    239239
    240         fibril_mutex_lock(&conn->lock);
     240        tcp_conn_lock(conn);
    241241
    242242        if (conn->cstate == st_closed) {
    243243                log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_close - ENOTEXIST");
    244                 fibril_mutex_unlock(&conn->lock);
     244                tcp_conn_unlock(conn);
    245245                return TCP_ENOTEXIST;
    246246        }
     
    250250                tcp_conn_reset(conn);
    251251                tcp_conn_remove(conn);
     252                tcp_conn_unlock(conn);
    252253                return TCP_EOK;
    253254        }
     
    255256        if (conn->snd_buf_fin) {
    256257                log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_close - ECLOSING");
    257                 fibril_mutex_unlock(&conn->lock);
     258                tcp_conn_unlock(conn);
    258259                return TCP_ECLOSING;
    259260        }
     
    263264        tcp_tqueue_new_data(conn);
    264265
    265         fibril_mutex_unlock(&conn->lock);
     266        tcp_conn_unlock(conn);
    266267        return TCP_EOK;
    267268}
     
    321322        }
    322323
    323         fibril_mutex_lock(&conn->lock);
     324        tcp_conn_lock(conn);
    324325
    325326        if (conn->cstate == st_closed) {
    326327                log_msg(LOG_DEFAULT, LVL_WARN, "Connection is closed.");
    327328                tcp_unexpected_segment(sp, seg);
    328                 fibril_mutex_unlock(&conn->lock);
     329                tcp_conn_unlock(conn);
    329330                tcp_conn_delref(conn);
    330331                return;
     
    342343        tcp_conn_segment_arrived(conn, seg);
    343344
    344         fibril_mutex_unlock(&conn->lock);
     345        tcp_conn_unlock(conn);
    345346        tcp_conn_delref(conn);
    346347}
Note: See TracChangeset for help on using the changeset viewer.