Changeset 06fe3b6 in mainline
- Timestamp:
- 2013-05-06T15:58:01Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d531bd6
- Parents:
- eef14771
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/dnsrsrv/transport.c
reef14771 r06fe3b6 54 54 #define REQ_TIMEOUT (5*1000*1000) 55 55 56 /** Maximum number of retries */ 57 #define REQ_RETRY_MAX 3 58 56 59 typedef struct { 57 60 link_t lreq; … … 184 187 struct sockaddr_in addr; 185 188 trans_req_t *treq; 189 int ntry; 186 190 187 191 req_data = NULL; … … 196 200 goto error; 197 201 198 rc = sendto(transport_fd, req_data, req_size, 0, 199 (struct sockaddr *)&addr, sizeof(addr)); 200 if (rc != EOK) 201 goto error; 202 203 treq = treq_create(req); 204 if (treq == NULL) { 205 rc = ENOMEM; 206 goto error; 207 } 208 209 fibril_mutex_lock(&treq->done_lock); 210 while (treq->done != true) { 211 rc = fibril_condvar_wait_timeout(&treq->done_cv, &treq->done_lock, 212 REQ_TIMEOUT); 213 if (rc == ETIMEOUT) { 214 fibril_mutex_unlock(&treq->done_lock); 215 rc = EIO; 202 ntry = 0; 203 204 while (ntry < REQ_RETRY_MAX) { 205 rc = sendto(transport_fd, req_data, req_size, 0, 206 (struct sockaddr *)&addr, sizeof(addr)); 207 if (rc != EOK) 208 goto error; 209 210 treq = treq_create(req); 211 if (treq == NULL) { 212 rc = ENOMEM; 216 213 goto error; 217 214 } 218 } 219 220 fibril_mutex_unlock(&treq->done_lock); 215 216 217 fibril_mutex_lock(&treq->done_lock); 218 while (treq->done != true) { 219 rc = fibril_condvar_wait_timeout(&treq->done_cv, &treq->done_lock, 220 REQ_TIMEOUT); 221 if (rc == ETIMEOUT) { 222 ++ntry; 223 break; 224 } 225 } 226 227 fibril_mutex_unlock(&treq->done_lock); 228 229 if (rc != ETIMEOUT) 230 break; 231 } 232 233 if (ntry >= REQ_RETRY_MAX) { 234 rc = EIO; 235 goto error; 236 } 221 237 222 238 if (treq->status != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.