Skip to content

Commit cd355ed

Browse files
authored
server : When listening on a unix domain socket don't print http:// and port (ggml-org#14180)
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 30e5b01 commit cd355ed

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
@@ -4878,7 +4878,9 @@ int main(int argc, char ** argv) {
48784878
};
48794879

48804880
bool was_bound = false;
4881+
bool is_sock = false;
48814882
if (string_ends_with(std::string(params.hostname), ".sock")) {
4883+
is_sock = true;
48824884
LOG_INF("%s: setting address family to AF_UNIX\n", __func__);
48834885
svr->set_address_family(AF_UNIX);
48844886
// bind_to_port requires a second arg, any value other than 0 should
@@ -4956,7 +4958,9 @@ int main(int argc, char ** argv) {
49564958
SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(console_ctrl_handler), true);
49574959
#endif
49584960

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

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

0 commit comments

Comments
 (0)