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

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


Ignore:
Timestamp:
2012-08-13T10:40:17Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
a1e2df13
Parents:
e5e73af
Message:

Terminate UDP receive fibril when socket is closed.

File:
1 edited

Legend:

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

    re5e73af r141a20d  
    5252        size_t req_size;
    5353        struct sockaddr_in addr;
     54        struct sockaddr_in laddr;
    5455        int fd;
    5556
    5657        addr.sin_family = AF_INET;
    5758        addr.sin_port = htons(53);
    58         addr.sin_addr.s_addr = htonl((192 << 24) | (168 << 16) | (0 << 8) | 1);
     59        addr.sin_addr.s_addr = htonl((10 << 24) | (0 << 16) | (0 << 8) | 1);
     60
     61        laddr.sin_family = AF_INET;
     62        laddr.sin_port = htons(12345);
     63        laddr.sin_addr.s_addr = INADDR_ANY;
    5964
    6065        req_data = NULL;
     
    7176        }
    7277
     78        rc = bind(fd, (struct sockaddr *)&laddr, sizeof(laddr));
     79        if (rc != EOK)
     80                goto error;
     81
    7382        printf("fd=%d req_data=%p, req_size=%zu\n", fd, req_data, req_size);
    7483        rc = sendto(fd, req_data, req_size, 0, (struct sockaddr *)&addr,
     
    7685        if (rc != EOK)
    7786                goto error;
     87
     88        closesocket(fd);
     89        free(req_data);
    7890
    7991        resp = NULL;
Note: See TracChangeset for help on using the changeset viewer.