MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / setup_child_server

Method setup_child_server

tools/server/server-models.cpp:838–869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

836}
837
838std::thread server_models::setup_child_server(const std::function<void(int)> & shutdown_handler) {
839 // send a notification to the router server that a model instance is ready
840 common_log_pause(common_log_main());
841 fflush(stdout);
842 fprintf(stdout, "%s\n", CMD_CHILD_TO_ROUTER_READY);
843 fflush(stdout);
844 common_log_resume(common_log_main());
845
846 // setup thread for monitoring stdin
847 return std::thread([shutdown_handler]() {
848 // wait for EOF on stdin
849 SRV_INF("%s", "child server monitoring thread started, waiting for EOF on stdin...\n");
850 bool eof = false;
851 while (true) {
852 std::string line;
853 if (!std::getline(std::cin, line)) {
854 // EOF detected, that means the router server is unexpectedly exit or killed
855 eof = true;
856 break;
857 }
858 if (line.find(CMD_ROUTER_TO_CHILD_EXIT) != std::string::npos) {
859 SRV_INF("%s", "exit command received, exiting...\n");
860 shutdown_handler(0);
861 break;
862 }
863 }
864 if (eof) {
865 SRV_INF("%s", "EOF on stdin detected, forcing shutdown...\n");
866 exit(1);
867 }
868 });
869}
870
871void server_models::notify_router_sleeping_state(bool is_sleeping) {
872 common_log_pause(common_log_main());

Callers

nothing calls this directly

Calls 4

common_log_pauseFunction · 0.85
common_log_mainFunction · 0.85
common_log_resumeFunction · 0.85
findMethod · 0.80

Tested by

no test coverage detected