Ignore:
File:
1 edited

Legend:

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

    r06fe3b6 r257feec  
    5252
    5353/** Request timeout (microseconds) */
    54 #define REQ_TIMEOUT (5*1000*1000)
     54#define REQ_TIMEOUT (5 * 1000 * 1000)
    5555
    5656/** Maximum number of retries */
    5757#define REQ_RETRY_MAX 3
     58
     59inet_addr_t dns_server_addr;
    5860
    5961typedef struct {
     
    7274static fid_t recv_fid;
    7375static int transport_fd = -1;
    74 inet_addr_t dns_server_addr;
    7576
    7677/** Outstanding requests */
     
    194195        addr.sin_family = AF_INET;
    195196        addr.sin_port = htons(DNS_SERVER_PORT);
    196         addr.sin_addr.s_addr = host2uint32_t_be(dns_server_addr.ipv4);
     197        inet_addr_sockaddr_in(&dns_server_addr, &addr);
    197198
    198199        rc = dns_message_encode(req, &req_data, &req_size);
     
    204205        while (ntry < REQ_RETRY_MAX) {
    205206                rc = sendto(transport_fd, req_data, req_size, 0,
    206                     (struct sockaddr *)&addr, sizeof(addr));
     207                    (struct sockaddr *) &addr, sizeof(addr));
    207208                if (rc != EOK)
    208209                        goto error;
    209 
     210               
    210211                treq = treq_create(req);
    211212                if (treq == NULL) {
     
    213214                        goto error;
    214215                }
    215 
    216 
     216               
    217217                fibril_mutex_lock(&treq->done_lock);
    218218                while (treq->done != true) {
     
    224224                        }
    225225                }
    226 
     226               
    227227                fibril_mutex_unlock(&treq->done_lock);
    228 
     228               
    229229                if (rc != ETIMEOUT)
    230230                        break;
    231231        }
    232 
     232       
    233233        if (ntry >= REQ_RETRY_MAX) {
    234234                rc = EIO;
    235235                goto error;
    236236        }
    237 
     237       
    238238        if (treq->status != EOK) {
    239239                rc = treq->status;
    240240                goto error;
    241241        }
    242 
     242       
    243243        *rresp = treq->resp;
    244244        treq_destroy(treq);
    245245        free(req_data);
    246246        return EOK;
     247       
    247248error:
    248249        if (treq != NULL)
    249250                treq_destroy(treq);
     251       
    250252        free(req_data);
    251253        return rc;
Note: See TracChangeset for help on using the changeset viewer.