aboutsummaryrefslogtreecommitdiff
path: root/src/integration-tests
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-09-27 20:01:46 +0000
committerLRN <lrn1986@gmail.com>2013-09-27 20:01:46 +0000
commitbc0b7fac93289d5b310a23837c55acd5ee11027b (patch)
tree12a8b8ece67caad65eaa1ec954d5dd6e3d67ec5a /src/integration-tests
parent04bae6c0252146282e34e27b1258b719067a3e5b (diff)
downloadgnunet-bc0b7fac93289d5b310a23837c55acd5ee11027b.tar.gz
gnunet-bc0b7fac93289d5b310a23837c55acd5ee11027b.zip
Fix connection_watchdog to work on W32
Diffstat (limited to 'src/integration-tests')
-rw-r--r--src/integration-tests/connection_watchdog.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/integration-tests/connection_watchdog.c b/src/integration-tests/connection_watchdog.c
index 73c86d8e4..cb34b69d7 100644
--- a/src/integration-tests/connection_watchdog.c
+++ b/src/integration-tests/connection_watchdog.c
@@ -206,9 +206,11 @@ static int
206check_lowlevel_connections (int port, int protocol) 206check_lowlevel_connections (int port, int protocol)
207{ 207{
208#ifdef MINGW 208#ifdef MINGW
209 /* not supported */ 209 #define DEVNULL "NUL"
210 return count;
211#else 210#else
211 #define DEVNULL "/dev/null"
212#endif
213
212 FILE *f; 214 FILE *f;
213 char * cmdline; 215 char * cmdline;
214 char * proto; 216 char * proto;
@@ -218,13 +220,25 @@ check_lowlevel_connections (int port, int protocol)
218 switch (protocol) 220 switch (protocol)
219 { 221 {
220 case tcp: 222 case tcp:
223#ifdef MINGW
224 proto = "-p TCP";
225#else
221 proto = "-t"; 226 proto = "-t";
227#endif
222 break; 228 break;
223 case udp: 229 case udp:
230#ifdef MINGW
231 proto = "-p UDP";
232#else
224 proto = "-u"; 233 proto = "-u";
234#endif
225 break; 235 break;
226 case unixdomain: 236 case unixdomain:
237#ifdef MINGW
238 proto = "-p UNIX";
239#else
227 proto = "-x"; 240 proto = "-x";
241#endif
228 break; 242 break;
229 default: 243 default:
230 proto = ""; 244 proto = "";
@@ -234,8 +248,8 @@ check_lowlevel_connections (int port, int protocol)
234 /* Use netstat to get a numeric list of all connections on port 'port' in state 'ESTABLISHED' */ 248 /* Use netstat to get a numeric list of all connections on port 'port' in state 'ESTABLISHED' */
235 GNUNET_asprintf(&cmdline, "netstat -n %s | grep %u | grep ESTABLISHED", proto, port); 249 GNUNET_asprintf(&cmdline, "netstat -n %s | grep %u | grep ESTABLISHED", proto, port);
236 250
237 if (system ("netstat -n > /dev/null 2> /dev/null")) 251 if (system ("netstat -n > " DEVNULL " 2> " DEVNULL))
238 if (system ("netstat -n > /dev/null 2> /dev/null") == 0) 252 if (system ("netstat -n > " DEVNULL " 2> "DEVNULL) == 0)
239 f = popen (cmdline, "r"); 253 f = popen (cmdline, "r");
240 else 254 else
241 f = NULL; 255 f = NULL;
@@ -263,7 +277,6 @@ check_lowlevel_connections (int port, int protocol)
263 pclose (f); 277 pclose (f);
264 GNUNET_free (cmdline); 278 GNUNET_free (cmdline);
265 return count; 279 return count;
266#endif
267} 280}
268 281
269 282