Ignore:
File:
1 edited

Legend:

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

    rd9e14fa4 r522a4f9  
    215215        tcp_sock_t lsocket;
    216216        tcp_sock_t fsocket;
    217         device_id_t dev_id;
     217        nic_device_id_t dev_id;
    218218        tcp_phdr_t *phdr;
    219219        size_t phdr_len;
     
    603603
    604604        socket = (tcp_sockdata_t *)sock_core->specific_data;
    605         rc = tcp_uc_close(socket->conn);
    606         if (rc != EOK) {
    607                 async_answer_0(callid, rc);
    608                 return;
    609         }
    610 
    611         /* Drain incoming data. This should really be done in the background. */
    612         do {
    613                 trc = tcp_uc_receive(socket->conn, buffer, FRAGMENT_SIZE,
    614                     &data_len, &xflags);
    615         } while (trc == TCP_EOK);
     605
     606        if (socket->conn != NULL) {
     607                trc = tcp_uc_close(socket->conn);
     608                if (trc != TCP_EOK && trc != TCP_ENOTEXIST) {
     609                        async_answer_0(callid, EBADF);
     610                        return;
     611                }
     612
     613                /* Drain incoming data. This should really be done in the background. */
     614                do {
     615                        trc = tcp_uc_receive(socket->conn, buffer,
     616                            FRAGMENT_SIZE, &data_len, &xflags);
     617                } while (trc == TCP_EOK);
     618
     619                tcp_uc_delete(socket->conn);
     620        }
    616621
    617622        rc = socket_destroy(net_sess, socket_id, &client->sockets, &gsock,
Note: See TracChangeset for help on using the changeset viewer.