Changeset ccb5165 in mainline for uspace/srv/net/dnsres/transport.c


Ignore:
Timestamp:
2013-04-20T07:28:39Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0041cd6d
Parents:
6d717a4
Message:

Do not hold recv_buffer_lock while calling udp_uc_receive().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/dnsres/transport.c

    r6d717a4 rccb5165  
    4545
    4646#include <stdio.h>
     47
     48#define RECV_BUF_SIZE 4096
     49
     50static uint8_t recv_buf[RECV_BUF_SIZE];
     51
    4752int dns_request(dns_message_t *req, dns_message_t **rresp)
    4853{
     
    5358        struct sockaddr_in addr;
    5459        struct sockaddr_in laddr;
     60        struct sockaddr_in src_addr;
     61        socklen_t src_addr_size;
    5562        int fd;
    5663
     
    8693                goto error;
    8794
     95        src_addr_size = sizeof(src_addr);
     96        rc = recvfrom(fd, recv_buf, RECV_BUF_SIZE, 0,
     97            (struct sockaddr *)&src_addr, &src_addr_size);
     98        if (rc < 0) {
     99                printf("recvfrom returns error - %d\n", rc);
     100                goto error;
     101        }
     102
     103        printf("received %d bytes\n", (int)rc);
     104
     105        printf("close socket\n");
    88106        closesocket(fd);
     107        printf("free req_data\n");
    89108        free(req_data);
    90109
Note: See TracChangeset for help on using the changeset viewer.