8000 When listening on a unix domain socket don't print http:// and port · ggml-org/llama.cpp@196223c · GitHub
[go: up one dir, main page]

Skip to content

Commit 196223c

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 <ecurtin@redhat.com>
1 parent 97340b4 commit 196223c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tools/server/server.cpp

Lines changed: 10 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,14 @@ 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+
std::string full_url;
4965+
if (is_sock) {
4966+
full_url = params.hostname;
4967+
} else {
4968+
full_url = "http://" + params.hostname + ":" + std::to_string(params.port);
4969+
}
4970+
4971+
LOG_INF("%s: server is listening on %s - starting the main loop\n", __func__, full_url.c_str());
49634972

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

0 commit comments

Comments
 (0)
0