Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset b0d82d1 in mainline for uspace/srv/net/tl/tcp/sock.c


Ignore:
Timestamp:
2011-11-30T21:36:36Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
26ec91c
Parents:
23fe06c
Message:

Implement socket close. Unlock mutexes on error paths.

File:
1 edited

Legend:

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

    r23fe06c rb0d82d1  
    553553        socket_core_t *sock_core;
    554554        tcp_sockdata_t *socket;
     555        tcp_error_t trc;
    555556        int rc;
     557        uint8_t buffer[FRAGMENT_SIZE];
     558        size_t data_len;
     559        xflags_t xflags;
    556560
    557561        log_msg(LVL_DEBUG, "tcp_sock_close()");
     
    565569
    566570        socket = (tcp_sockdata_t *)sock_core->specific_data;
    567         (void) socket;
    568         /* XXX Close */
     571        rc = tcp_uc_close(socket->conn);
     572        if (rc != EOK) {
     573                async_answer_0(callid, rc);
     574                return;
     575        }
     576
     577        /* Drain incoming data. This should really be done in the background. */
     578        do {
     579                trc = tcp_uc_receive(socket->conn, buffer, FRAGMENT_SIZE,
     580                    &data_len, &xflags);
     581        } while (trc == TCP_EOK);
    569582
    570583        rc = socket_destroy(net_sess, socket_id, &client->sockets, &gsock,
Note: See TracChangeset for help on using the changeset viewer.