Changeset 8c7a054 in mainline for uspace/srv/net/tl/tcp/state.c


Ignore:
Timestamp:
2011-10-21T15:25:43Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
32aea9f4
Parents:
d9ce049
Message:

FIN processing (WIP).

File:
1 edited

Legend:

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

    rd9ce049 r8c7a054  
    115115
    116116        /* Wait for data to become available */
    117         while (conn->rcv_buf_used == 0) {
     117        while (conn->rcv_buf_used == 0 && !conn->rcv_buf_fin) {
    118118                log_msg(LVL_DEBUG, "tcp_uc_receive() - wait for data");
    119119                fibril_condvar_wait(&conn->rcv_buf_cv, &conn->rcv_buf_lock);
     120        }
     121
     122        if (conn->rcv_buf_used == 0) {
     123                /* End of data, peer closed connection. */
     124                /* XXX How should RECEIVE signal end of data? */
     125                assert(conn->rcv_buf_fin);
     126                *rcvd = 0;
     127                *xflags = 0;
     128                return;
    120129        }
    121130
     
    147156{
    148157        log_msg(LVL_DEBUG, "tcp_uc_close()");
     158
     159        conn->snd_buf_fin = true;
     160        tcp_tqueue_new_data(conn);
    149161}
    150162
Note: See TracChangeset for help on using the changeset viewer.