slige/runtime/rpc_server.cpp

16 lines
544 B
C++

#include "rpc_server.hpp"
#include "socket.hpp"
#include <sys/socket.h>
#include <unistd.h>
auto slige_rpc::RpcServer::bind(
uint16_t port) -> std::variant<slige_rpc::RpcServer, slige_socket::Ewwow>
{
std::variant<slige_socket::ServerSocket, slige_socket::Ewwow> socket_result
= slige_socket::Socket::bind(port);
if (std::holds_alternative<slige_socket::Ewwow>(socket_result)) {
return std::get<slige_socket::Ewwow>(socket_result);
}
return RpcServer(std::get<slige_socket::ServerSocket>(socket_result));
}