Changeset d9e14fa4 in mainline for uspace/srv/net/tl/tcp/ucall.c


Ignore:
Timestamp:
2011-12-09T16:06:28Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
03be171
Parents:
0ac2158
Message:

Implement RST processing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tl/tcp/ucall.c

    r0ac2158 rd9e14fa4  
    126126        while (size > 0) {
    127127                buf_free = conn->snd_buf_size - conn->snd_buf_used;
    128                 while (buf_free == 0)
     128                while (buf_free == 0 && !conn->reset)
    129129                        tcp_tqueue_new_data(conn);
     130
     131                if (conn->reset)
     132                        return TCP_ERESET;
    130133
    131134                xfer_size = min(size, buf_free);
     
    157160
    158161        /* Wait for data to become available */
    159         while (conn->rcv_buf_used == 0 && !conn->rcv_buf_fin) {
     162        while (conn->rcv_buf_used == 0 && !conn->rcv_buf_fin && !conn->reset) {
    160163                log_msg(LVL_DEBUG, "tcp_uc_receive() - wait for data");
    161164                fibril_condvar_wait(&conn->rcv_buf_cv, &conn->rcv_buf_lock);
     
    165168                fibril_mutex_unlock(&conn->rcv_buf_lock);
    166169
    167                 /* End of data, peer closed connection. */
    168                 assert(conn->rcv_buf_fin);
    169170                *rcvd = 0;
    170171                *xflags = 0;
    171                 return TCP_ECLOSING;
     172
     173                if (conn->rcv_buf_fin) {
     174                        /* End of data, peer closed connection */
     175                        return TCP_ECLOSING;
     176                } else {
     177                        /* Connection was reset */
     178                        assert(conn->reset);
     179                        return TCP_ERESET;
     180                }
    172181        }
    173182
Note: See TracChangeset for help on using the changeset viewer.