Changeset c3f7d37 in mainline for uspace/lib/c/generic/inet/tcp.c


Ignore:
Timestamp:
2015-06-07T12:36:44Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
048cd69
Parents:
5a5b087
Message:

Remove excessive debugging output.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/inet/tcp.c

    r5a5b087 rc3f7d37  
    4141#include <stdlib.h>
    4242
    43 #include <stdio.h>
    44 
    4543static void tcp_cb_conn(ipc_callid_t, ipc_call_t *, void *);
    4644static int tcp_conn_fibril(void *);
     
    5654        async_exch_t *exch = async_exchange_begin(tcp->sess);
    5755
    58         printf("tcp_callback_create()\n");
    59 
    6056        aid_t req = async_send_0(exch, TCP_CALLBACK_CREATE, NULL);
    6157        int rc = async_connect_to_me(exch, 0, 0, 0, tcp_cb_conn, tcp);
     
    7672        service_id_t tcp_svcid;
    7773        int rc;
    78 
    79         printf("tcp_create()\n");
    8074
    8175        tcp = calloc(1, sizeof(tcp_t));
     
    129123        tcp_conn_t *conn;
    130124
    131         printf("tcp_conn_new()\n");
    132 
    133125        conn = calloc(1, sizeof(tcp_conn_t));
    134126        if (conn == NULL)
     
    157149        sysarg_t conn_id;
    158150
    159         printf("tcp_conn_create()\n");
    160 
    161151        exch = async_exchange_begin(tcp->sess);
    162152        aid_t req = async_send_0(exch, TCP_CONN_CREATE, &answer);
     
    192182        async_exch_t *exch;
    193183
    194         printf("tcp_conn_destroy()\n");
    195 
    196184        if (conn == NULL)
    197185                return;
     
    230218        tcp_listener_t *lst;
    231219        ipc_call_t answer;
    232 
    233         printf("tcp_listener_create()\n");
    234220
    235221        lst = calloc(1, sizeof(tcp_listener_t));
     
    274260{
    275261        async_exch_t *exch;
    276 
    277         printf("tcp_listener_destroy()\n");
    278262
    279263        if (lst == NULL)
     
    328312        sysarg_t rc;
    329313
    330         printf("tcp_conn_send()\n");
    331 
    332314        exch = async_exchange_begin(conn->tcp->sess);
    333315        aid_t req = async_send_1(exch, TCP_CONN_SEND, conn->id, NULL);
     
    355337        async_exch_t *exch;
    356338
    357         printf("tcp_conn_send_fin()\n");
    358 
    359339        exch = async_exchange_begin(conn->tcp->sess);
    360340        sysarg_t rc = async_req_1_0(exch, TCP_CONN_SEND_FIN, conn->id);
     
    368348        async_exch_t *exch;
    369349
    370         printf("tcp_conn_push()\n");
    371 
    372350        exch = async_exchange_begin(conn->tcp->sess);
    373351        sysarg_t rc = async_req_1_0(exch, TCP_CONN_PUSH, conn->id);
     
    381359        async_exch_t *exch;
    382360
    383         printf("tcp_conn_reset()\n");
    384 
    385361        exch = async_exchange_begin(conn->tcp->sess);
    386362        sysarg_t rc = async_req_1_0(exch, TCP_CONN_RESET, conn->id);
     
    395371        ipc_call_t answer;
    396372
    397         printf("tcp_conn_recv() bsize=%zu\n", bsize);
    398 
    399373        fibril_mutex_lock(&conn->lock);
    400374        if (!conn->data_avail) {
    401                 printf("returning EAGAIN\n");
    402375                fibril_mutex_unlock(&conn->lock);
    403376                return EAGAIN;
     
    410383
    411384        if (rc != EOK) {
    412                 printf("got rc = %d\n", rc);
    413385                async_forget(req);
    414386                fibril_mutex_unlock(&conn->lock);
     
    419391        async_wait_for(req, &retval);
    420392        if (retval != EOK) {
    421                 printf("got rc = %d\n", rc);
    422393                fibril_mutex_unlock(&conn->lock);
    423394                return retval;
     
    434405        ipc_call_t answer;
    435406
    436         printf("tcp_conn_recv_wait() bsize=%zu\n", bsize);
    437407again:
    438408        fibril_mutex_lock(&conn->lock);
    439409        while (!conn->data_avail) {
    440                 printf("wait for data to be avail\n");
    441410                fibril_condvar_wait(&conn->cv, &conn->lock);
    442411        }
    443412
    444         printf("tcp_conn_recv_wait - get data\n");
    445413        exch = async_exchange_begin(conn->tcp->sess);
    446414        aid_t req = async_send_1(exch, TCP_CONN_RECV_WAIT, conn->id, &answer);
    447415        int rc = async_data_read_start(exch, buf, bsize);
    448         printf("tcp_conn_recv_wait - rc = %d\n", rc);
    449         async_exchange_end(exch);
    450 
    451         if (rc != EOK) {
    452                 printf("got rc=%d\n", rc);
     416        async_exchange_end(exch);
     417
     418        if (rc != EOK) {
    453419                async_forget(req);
    454420                if (rc == EAGAIN) {
     
    464430        async_wait_for(req, &retval);
    465431        if (retval != EOK) {
    466                 printf("got retval != EOK\n");
    467432                if (rc == EAGAIN) {
    468                         printf("rc == EAGAIN\n");
    469433                        conn->data_avail = false;
    470434                }
     
    475439        *nrecv = IPC_GET_ARG1(answer);
    476440        fibril_mutex_unlock(&conn->lock);
    477         printf("tcp_conn_recv_wait: nrecv=%zu\n", *nrecv);
    478         printf("received: '");
    479         size_t i;
    480         for (i = 0; i < *nrecv; i++) {
    481                 putchar((char)((char *)buf)[i]);
    482         }
    483         printf("'\n");
    484441        return EOK;
    485442}
     
    491448        int rc;
    492449
    493         printf("tcp_ev_connected()\n");
    494450        conn_id = IPC_GET_ARG1(*icall);
    495451
    496452        rc = tcp_conn_get(tcp, conn_id, &conn);
    497453        if (rc != EOK) {
    498                 printf("conn ID %zu not found\n",
    499                     conn_id);
    500454                async_answer_0(iid, ENOENT);
    501455                return;
     
    516470        int rc;
    517471
    518         printf("tcp_ev_conn_failed()\n");
    519472        conn_id = IPC_GET_ARG1(*icall);
    520473
    521474        rc = tcp_conn_get(tcp, conn_id, &conn);
    522475        if (rc != EOK) {
    523                 printf("conn ID %zu not found\n",
    524                     conn_id);
    525476                async_answer_0(iid, ENOENT);
    526477                return;
     
    541492        int rc;
    542493
    543         printf("tcp_ev_conn_reset()\n");
    544494        conn_id = IPC_GET_ARG1(*icall);
    545495
    546496        rc = tcp_conn_get(tcp, conn_id, &conn);
    547497        if (rc != EOK) {
    548                 printf("conn ID %zu not found\n",
    549                     conn_id);
    550498                async_answer_0(iid, ENOENT);
    551499                return;
     
    566514        int rc;
    567515
    568         printf("tcp_ev_data()\n");
    569516        conn_id = IPC_GET_ARG1(*icall);
    570517
    571518        rc = tcp_conn_get(tcp, conn_id, &conn);
    572519        if (rc != EOK) {
    573                 printf("conn ID %zu not found\n",
    574                     conn_id);
    575520                async_answer_0(iid, ENOENT);
    576521                return;
     
    585530static void tcp_ev_urg_data(tcp_t *tcp, ipc_callid_t iid, ipc_call_t *icall)
    586531{
    587         printf("tcp_ev_urg_data()\n");
    588532        async_answer_0(iid, ENOTSUP);
    589533}
     
    599543        int rc;
    600544
    601         printf("tcp_ev_new_conn()\n");
    602545        lst_id = IPC_GET_ARG1(*icall);
    603546        conn_id = IPC_GET_ARG2(*icall);
    604547
    605         printf("new conn: lst_id=%zu conn_id=%zu\n", lst_id, conn_id);
    606 
    607548        rc = tcp_listener_get(tcp, lst_id, &lst);
    608549        if (rc != EOK) {
    609                 printf("listener ID %zu not found\n",
    610                     lst_id);
    611550                async_answer_0(iid, ENOENT);
    612551                return;
     
    615554        rc = tcp_conn_new(tcp, conn_id, lst->cb, lst->cb_arg, &conn);
    616555        if (rc != EOK) {
    617                 printf("Failed creating new incoming connection.\n");
    618556                async_answer_0(iid, ENOMEM);
    619557                return;
     
    621559
    622560        if (lst->lcb != NULL && lst->lcb->new_conn != NULL) {
    623                 printf("Creating connection fibril\n");
    624561                cinfo = calloc(1, sizeof(tcp_in_conn_t));
    625562                if (cinfo == NULL) {
    626                         printf("Failed creating new incoming connection info.\n");
    627563                        async_answer_0(iid, ENOMEM);
    628564                        return;
     
    634570                fid = fibril_create(tcp_conn_fibril, cinfo);
    635571                if (fid == 0) {
    636                         printf("Error creating connection fibril.\n");
    637572                        async_answer_0(iid, ENOMEM);
    638573                }
     
    649584
    650585        async_answer_0(iid, EOK);
    651 
    652         printf("tcp_cb_conn()\n");
    653586
    654587        while (true) {
     
    656589                ipc_callid_t callid = async_get_call(&call);
    657590
    658                 printf("tcp_cb_conn() - msg %d\n",
    659                     (int)IPC_GET_IMETHOD(call));
    660591                if (!IPC_GET_IMETHOD(call)) {
    661592                        /* TODO: Handle hangup */
     
    694625        tcp_in_conn_t *cinfo = (tcp_in_conn_t *)arg;
    695626
    696         printf("tcp_conn_fibril: begin\n");
    697627        cinfo->lst->lcb->new_conn(cinfo->lst, cinfo->conn);
    698         printf("tcp_conn_fibril: end\n");
    699628        tcp_conn_destroy(cinfo->conn);
    700629
Note: See TracChangeset for help on using the changeset viewer.