rpc : throw an exception when the RPC endpoint is unreachable

Returning nullptr in this case leads to obscure crashes, better fail
fast
This commit is contained in:
Radoslav Gerganov 2024-06-14 11:47:48 +03:00
parent 172c825684
commit 3cd9404cc0

View file

@ -671,7 +671,7 @@ GGML_API GGML_CALL ggml_backend_buffer_type_t ggml_backend_rpc_buffer_type(const
} }
auto sock = get_socket(endpoint); auto sock = get_socket(endpoint);
if (sock == nullptr) { if (sock == nullptr) {
return nullptr; throw std::runtime_error("Failed to connect to " + std::string(endpoint));
} }
size_t alignment = get_alignment(sock); size_t alignment = get_alignment(sock);
size_t max_size = get_max_size(sock); size_t max_size = get_max_size(sock);