Changeset 7c912b6 in mainline


Ignore:
Timestamp:
2012-05-12T09:39:20Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0d67e16
Parents:
01a7aa1
Message:

Fix delivery of end-of-connection condition.

Location:
uspace
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/nterm/conn.c

    r01a7aa1 r7c912b6  
    3838#include <net/socket.h>
    3939#include <stdio.h>
     40#include <str_error.h>
    4041#include <sys/types.h>
    4142
     
    4647static fid_t rcv_fid;
    4748
    48 #define RECV_BUF_SIZE 1
     49#define RECV_BUF_SIZE 1024
    4950static uint8_t recv_buf[RECV_BUF_SIZE];
    5051
     
    6162        }
    6263
    63         printf("Recv fibril terminated.\n");
     64        if (nr == ENOTCONN)
     65                printf("\n[Other side has closed the connection]\n");
     66        else
     67                printf("'\n[Receive errror (%s)]\n", str_error(nr));
    6468
    6569        return 0;
  • uspace/app/nterm/nterm.c

    r01a7aa1 r7c912b6  
    6868        rc = conn_send(cbuf, offs);
    6969        if (rc != EOK) {
    70                 printf("Failed sending data.\n");
     70                printf("[Failed sending data]\n");
    7171        }
    7272}
     
    106106                putchar(dp[i]);
    107107        }
     108
     109        fflush(stdout);
    108110}
    109111
  • uspace/srv/net/tcp/conn.c

    r01a7aa1 r7c912b6  
    184184void tcp_conn_addref(tcp_conn_t *conn)
    185185{
    186         log_msg(LVL_DEBUG, "%s: tcp_conn_addref(%p)", conn->name, conn);
     186        log_msg(LVL_DEBUG2, "%s: tcp_conn_addref(%p)", conn->name, conn);
    187187        atomic_inc(&conn->refcnt);
    188188}
     
    196196void tcp_conn_delref(tcp_conn_t *conn)
    197197{
    198         log_msg(LVL_DEBUG, "%s: tcp_conn_delref(%p)", conn->name, conn);
     198        log_msg(LVL_DEBUG2, "%s: tcp_conn_delref(%p)", conn->name, conn);
    199199
    200200        if (atomic_predec(&conn->refcnt) == 0)
     
    312312static bool tcp_socket_match(tcp_sock_t *sock, tcp_sock_t *patt)
    313313{
    314         log_msg(LVL_DEBUG, "tcp_socket_match(sock=(%x,%u), pat=(%x,%u))",
     314        log_msg(LVL_DEBUG2, "tcp_socket_match(sock=(%x,%u), pat=(%x,%u))",
    315315            sock->addr.ipv4, sock->port, patt->addr.ipv4, patt->port);
    316316
     
    323323                return false;
    324324
    325         log_msg(LVL_DEBUG, " -> match");
     325        log_msg(LVL_DEBUG2, " -> match");
    326326
    327327        return true;
     
    331331static bool tcp_sockpair_match(tcp_sockpair_t *sp, tcp_sockpair_t *pattern)
    332332{
    333         log_msg(LVL_DEBUG, "tcp_sockpair_match(%p, %p)", sp, pattern);
     333        log_msg(LVL_DEBUG2, "tcp_sockpair_match(%p, %p)", sp, pattern);
    334334
    335335        if (!tcp_socket_match(&sp->local, &pattern->local))
     
    360360                tcp_conn_t *conn = list_get_instance(link, tcp_conn_t, link);
    361361                tcp_sockpair_t *csp = &conn->ident;
    362                 log_msg(LVL_DEBUG, "compare with conn (f:(%x,%u), l:(%x,%u))",
     362                log_msg(LVL_DEBUG2, "compare with conn (f:(%x,%u), l:(%x,%u))",
    363363                    csp->foreign.addr.ipv4, csp->foreign.port,
    364364                    csp->local.addr.ipv4, csp->local.port);
  • uspace/srv/net/tcp/segment.c

    r01a7aa1 r7c912b6  
    248248void tcp_segment_dump(tcp_segment_t *seg)
    249249{
    250         log_msg(LVL_DEBUG, "Segment dump:");
    251         log_msg(LVL_DEBUG, " - ctrl = %u", (unsigned)seg->ctrl);
    252         log_msg(LVL_DEBUG, " - seq = % " PRIu32, seg->seq);
    253         log_msg(LVL_DEBUG, " - ack = % " PRIu32, seg->ack);
    254         log_msg(LVL_DEBUG, " - len = % " PRIu32, seg->len);
    255         log_msg(LVL_DEBUG, " - wnd = % " PRIu32, seg->wnd);
    256         log_msg(LVL_DEBUG, " - up = % " PRIu32, seg->up);
     250        log_msg(LVL_DEBUG2, "Segment dump:");
     251        log_msg(LVL_DEBUG2, " - ctrl = %u", (unsigned)seg->ctrl);
     252        log_msg(LVL_DEBUG2, " - seq = % " PRIu32, seg->seq);
     253        log_msg(LVL_DEBUG2, " - ack = % " PRIu32, seg->ack);
     254        log_msg(LVL_DEBUG2, " - len = % " PRIu32, seg->len);
     255        log_msg(LVL_DEBUG2, " - wnd = % " PRIu32, seg->wnd);
     256        log_msg(LVL_DEBUG2, " - up = % " PRIu32, seg->up);
    257257}
    258258
  • uspace/srv/net/tcp/sock.c

    r01a7aa1 r7c912b6  
    652652        log_msg(LVL_DEBUG, "tcp_sock_recvfrom(): lock recv_buffer_lock");
    653653        fibril_mutex_lock(&socket->recv_buffer_lock);
    654         while (socket->recv_buffer_used == 0) {
     654        while (socket->recv_buffer_used == 0 && socket->recv_error == TCP_EOK) {
    655655                log_msg(LVL_DEBUG, "wait for recv_buffer_cv + recv_buffer_used != 0");
    656656                fibril_condvar_wait(&socket->recv_buffer_cv,
     
    850850                if (trc != TCP_EOK) {
    851851                        sock->recv_error = trc;
     852                        fibril_condvar_broadcast(&sock->recv_buffer_cv);
    852853                        fibril_mutex_unlock(&sock->recv_buffer_lock);
     854                        tcp_sock_notify_data(sock->sock_core);
    853855                        break;
    854856                }
     
    857859
    858860                sock->recv_buffer_used = data_len;
     861                fibril_condvar_broadcast(&sock->recv_buffer_cv);
    859862                fibril_mutex_unlock(&sock->recv_buffer_lock);
    860                 fibril_condvar_broadcast(&sock->recv_buffer_cv);
    861863                tcp_sock_notify_data(sock->sock_core);
    862864        }
Note: See TracChangeset for help on using the changeset viewer.