summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-05-27 14:08:25 +0200
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-05-27 14:08:25 +0200
commit17e9c86c2fa45b39b88b73f9fd34c2d9b95ae7d4 (patch)
tree7c22647cdb245c699591791bfd7515800dd6265a
parent575a002bda3253ededd3e30146546769da465c7e (diff)
parentbaafb76b2d69b6cfd4be94b02be68dce86247bc0 (diff)
downloadouroboros-17e9c86c2fa45b39b88b73f9fd34c2d9b95ae7d4.tar.gz
ouroboros-17e9c86c2fa45b39b88b73f9fd34c2d9b95ae7d4.zip
Merged in dstaesse/ouroboros/be-select-fix (pull request #115)
ipcpd: fixed the shim-udp grinding the cpu
-rw-r--r--src/ipcpd/shim-udp/main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index 0fc1c78a..db9a89e2 100644
--- a/src/ipcpd/shim-udp/main.c
+++ b/src/ipcpd/shim-udp/main.c
@@ -62,6 +62,7 @@ typedef ShimUdpMsg shim_udp_msg_t;
#define SHIM_UDP_MSG_SIZE 256
#define SHIM_UDP_MAX_SDU_SIZE 8980
#define DNS_TTL 86400
+#define FD_UPDATE_TIMEOUT 100 /* microseconds */
#define shim_data(type) ((struct ipcp_udp_data *) type->data)
@@ -714,12 +715,13 @@ static void * ipcp_udp_sdu_reader()
int n;
int fd;
char buf[SHIM_UDP_MAX_SDU_SIZE];
- struct timeval tv = {0, 100};
struct sockaddr_in r_saddr;
fd_set read_fds;
int flags;
while (true) {
+ struct timeval tv = {0, FD_UPDATE_TIMEOUT};
+
rw_lock_rdlock(&_ipcp->state_lock);
if (_ipcp->state != IPCP_ENROLLED) {
@@ -759,8 +761,7 @@ static void * ipcp_udp_sdu_reader()
continue;
/* send the sdu to the correct port_id */
- if (ipcp_udp_flow_write(fd, buf, n) < 0)
- LOG_ERR("Failed to write SDU.");
+ ipcp_udp_flow_write(fd, buf, n);
}
}