about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-10-25 12:40:07 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-10-25 12:40:07 -0700
commitaac885fde005e07508430215269b71a0bdb54dbf (patch)
treed5242aeba73edecad73d443f5c0807f53c66d145
parent215e35e4dd2a815707efab34e5101376d7fddf2a (diff)
downloadmu-aac885fde005e07508430215269b71a0bdb54dbf.tar.gz
3595
Fix for that annoying popup from the Mac OS firewall: inside tests keep
any opened ports accessible only to localhost.
-rw-r--r--091socket.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/091socket.cc b/091socket.cc
index 2aebbed8..51790bdf 100644
--- a/091socket.cc
+++ b/091socket.cc
@@ -122,7 +122,7 @@ socket_t* server_socket(int port) {
   int dummy = 0;
   setsockopt(result->fd, SOL_SOCKET, SO_REUSEADDR, &dummy, sizeof(dummy));
   result->addr.sin_family = AF_INET;
-  result->addr.sin_addr.s_addr = INADDR_ANY;
+  result->addr.sin_addr.s_addr = Current_scenario ? htonl(INADDR_LOOPBACK) : INADDR_ANY;  // run tests without running afoul of any firewall
   result->addr.sin_port = htons(port);
   if (bind(result->fd, reinterpret_cast<sockaddr*>(&result->addr), sizeof(result->addr)) >= 0) {
     listen(result->fd, /*queue length*/5);