Skip to content
Snippets Groups Projects
Commit aa33a94e authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

Merge pull request #411 from FreifunkBremen/feature-neighbour-info-timeout

gluon-neighbour-info: Support sub-second timeout
parents e8781556 9f91a5f8
No related branches found
No related tags found
No related merge requests found
...@@ -78,7 +78,7 @@ ssize_t recvtimeout(int socket, void *buffer, size_t length, int flags, struct t ...@@ -78,7 +78,7 @@ ssize_t recvtimeout(int socket, void *buffer, size_t length, int flags, struct t
return ret; return ret;
} }
int request(const int sock, const struct sockaddr_in6 *client_addr, const char *request, bool sse, int timeout) { int request(const int sock, const struct sockaddr_in6 *client_addr, const char *request, bool sse, double timeout) {
ssize_t ret; ssize_t ret;
char buffer[8192]; char buffer[8192];
...@@ -90,8 +90,8 @@ int request(const int sock, const struct sockaddr_in6 *client_addr, const char * ...@@ -90,8 +90,8 @@ int request(const int sock, const struct sockaddr_in6 *client_addr, const char *
} }
struct timeval tv_timeout, tv_offset; struct timeval tv_timeout, tv_offset;
tv_timeout.tv_sec = timeout; tv_timeout.tv_sec = (int) timeout;
tv_timeout.tv_usec = 0; tv_timeout.tv_usec = ((int) (timeout * 1000000)) % 1000000;
getclock(&tv_offset); getclock(&tv_offset);
...@@ -137,7 +137,7 @@ int main(int argc, char **argv) { ...@@ -137,7 +137,7 @@ int main(int argc, char **argv) {
int port_set = 0; int port_set = 0;
int destination_set = 0; int destination_set = 0;
int timeout = 3; double timeout = 3.0;
bool sse = false; bool sse = false;
int c; int c;
...@@ -163,7 +163,7 @@ int main(int argc, char **argv) { ...@@ -163,7 +163,7 @@ int main(int argc, char **argv) {
request_string = optarg; request_string = optarg;
break; break;
case 't': case 't':
timeout = atoi(optarg); timeout = atof(optarg);
break; break;
case 's': case 's':
sse = true; sse = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment