MCPcopy Create free account
hub / github.com/78/tenbox / HandleClient

Method HandleClient

src/manager/llm_proxy.cpp:270–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270void LlmProxyService::HandleClient(uintptr_t client_sock) {
271 SOCKET sock = static_cast<SOCKET>(client_sock);
272 bool keep_alive = true;
273
274 while (keep_alive && running_) {
275 std::string method, path, body;
276 if (!ParseHttpRequest(client_sock, method, path, body, keep_alive))
277 break;
278
279 // Route
280 if (method == "POST" && (path == "/v1/chat/completions" ||
281 path == "/chat/completions")) {
282 HandleChatCompletions(client_sock, body, keep_alive);
283 } else if (method == "GET" && (path == "/v1/models" || path == "/models")) {
284 HandleModels(client_sock, keep_alive);
285 } else {
286 SendErrorResponse(client_sock, 404, "Not Found",
287 "Unknown endpoint: " + path, keep_alive);
288 }
289 }
290 closesocket(sock);
291}
292
293bool LlmProxyService::ParseHttpRequest(uintptr_t sock_u, std::string& method,
294 std::string& path, std::string& body,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected