mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 03:45:24 +00:00
netperf: add support to timeout if host went away
This commit is contained in:
parent
5d79c6be1a
commit
9f2097669a
@ -48,6 +48,35 @@ Index: src/nettest_omni.c
|
||||
|
||||
int timed_out = 0;
|
||||
int pad_time = 0;
|
||||
@@ -5312,6 +5312,28 @@
|
||||
need_to_accept = 0;
|
||||
connected = 1;
|
||||
|
||||
+#ifdef GENODE_BUILD
|
||||
+ /*
|
||||
+ * We don't support setitimer which uses signals. Instead set timeouts on
|
||||
+ * the send and recv socket functions to be able to terminate if the host
|
||||
+ * went away.
|
||||
+ */
|
||||
+ struct timeval timeout;
|
||||
+ /* XXX LWIP expect ms instead of seconds */
|
||||
+ timeout.tv_sec = 10 * 1000;
|
||||
+ timeout.tv_usec = 0;
|
||||
+
|
||||
+ int sock_error = setsockopt(data_socket, SOL_SOCKET, SO_SNDTIMEO, &timeout,
|
||||
+ sizeof(timeout));
|
||||
+ if (sock_error)
|
||||
+ fprintf(where, "could not send timeout for send - test may not terminate\n");
|
||||
+
|
||||
+ sock_error = setsockopt(data_socket, SOL_SOCKET, SO_RCVTIMEO, &timeout,
|
||||
+ sizeof(timeout));
|
||||
+ if (sock_error)
|
||||
+ fprintf(where, "could not send timeout for recv - test may not terminate\n");
|
||||
+#endif
|
||||
+
|
||||
#ifdef KLUDGE_SOCKET_OPTIONS
|
||||
/* this is for those systems which *INCORRECTLY* fail to pass
|
||||
attributes across an accept() call. Including this goes
|
||||
Index: src/nettest_bsd.h
|
||||
===================================================================
|
||||
--- src/nettest_bsd.h (revision 644)
|
||||
|
@ -5,7 +5,7 @@
|
||||
extern void dump_addrinfo(FILE *dumploc, struct addrinfo *info,
|
||||
char *host, char *port, int family);
|
||||
+#ifdef GENODE_BUILD
|
||||
+static inline void start_timer(int time) { printf("%s: not supported\n", __FUNCTION__);}
|
||||
+static inline void start_timer(int time) { }
|
||||
+#else
|
||||
extern void start_timer(int time);
|
||||
+#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user