upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/main_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main_gui.cpp')
-rw-r--r--src/main_gui.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 842b0d5..edc772d 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -58,6 +58,7 @@ static void PrintUsage()
58 printf(" /connectbtf=PEER_BTF_ADDRESS\n"); 58 printf(" /connectbtf=PEER_BTF_ADDRESS\n");
59 printf(" /rvrelay=HOST:PORT\n"); 59 printf(" /rvrelay=HOST:PORT\n");
60 printf(" /announcerelay=HOST:PORT\n"); 60 printf(" /announcerelay=HOST:PORT\n");
61 printf(" /port=N (P2P listen port, default 8433)\n");
61 printf("\n"); 62 printf("\n");
62 printf("Each option also accepts '-' instead of '/'.\n"); 63 printf("Each option also accepts '-' instead of '/'.\n");
63} 64}
@@ -113,6 +114,23 @@ static void ParseStartupArguments(int argc, char* argv[])
113 string announceRelay = argval2(argc, argv, "/announcerelay", "-announcerelay"); 114 string announceRelay = argval2(argc, argv, "/announcerelay", "-announcerelay");
114 if (!announceRelay.empty()) 115 if (!announceRelay.empty())
115 strBtfAnnounceRelay = announceRelay; 116 strBtfAnnounceRelay = announceRelay;
117
118 // net.cpp has claimed nListenPort was "tunable via /port" since it was
119 // written, but nothing ever read the option. Without it a second node
120 // cannot start on a machine that already runs one -- which is exactly what
121 // testing peer exchange needs.
122 string strPort = argval2(argc, argv, "/port", "-port");
123 if (!strPort.empty())
124 {
125 int nPort = atoi(strPort.c_str());
126 if (nPort <= 0 || nPort > 65535)
127 fprintf(stderr, "Ignoring /port=%s: not a port number\n", strPort.c_str());
128 else
129 {
130 nListenPort = htons((unsigned short)nPort);
131 addrLocalHost.port = nListenPort; // or we advertise a port we never bound
132 }
133 }
116} 134}
117 135
118int main(int argc, char* argv[]) 136int main(int argc, char* argv[])