Skip to content

Commit 168bf92

Browse files
committed
When listening on a unix domain socket don't print http:// and port
Instead show something like this: main: server is listening on file.sock - starting the main loop Signed-off-by: Eric Curtin <[email protected]>
1 parent 97340b4 commit 168bf92

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/server/server.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4881,7 +4881,9 @@ int main(int argc, char ** argv) {
48814881
};
48824882

48834883
bool was_bound = false;
4884+
bool is_sock = false;
48844885
if (string_ends_with(std::string(params.hostname), ".sock")) {
4886+
is_sock = true;
48854887
LOG_INF("%s: setting address family to AF_UNIX\n", __func__);
48864888
svr->set_address_family(AF_UNIX);
48874889
// bind_to_port requires a second arg, any value other than 0 should
@@ -4959,7 +4961,9 @@ int main(int argc, char ** argv) {
49594961
SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(console_ctrl_handler), true);
49604962
#endif
49614963

4962-
LOG_INF("%s: server is listening on http://%s:%d - starting the main loop\n", __func__, params.hostname.c_str(), params.port);
4964+
LOG_INF("%s: server is listening on %s - starting the main loop\n", __func__,
4965+
is_sock ? string_format("unix://%s", params.hostname.c_str()).c_str() :
4966+
string_format("http://%s:%d", params.hostname.c_str(), params.port).c_str());
49634967

49644968
// this call blocks the main thread until queue_tasks.terminate() is called
49654969
ctx_server.queue_tasks.start_loop();

0 commit comments

Comments
 (0)