mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-18 22:46:30 +00:00
16 lines
544 B
C++
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));
|
|
}
|