Program Listing for File ReceiveSocket.hpp
↰ Return to documentation for file (BackendLibfabric/ReceiveSocket.hpp
)
#ifndef NETIO3BACKEND_BACKENDLIBFABRIC_RECEIVESOCKET_HPP
#define NETIO3BACKEND_BACKENDLIBFABRIC_RECEIVESOCKET_HPP
#include <rdma/fi_domain.h>
#include "BaseSocket.hpp"
#include "DomainManager.hpp"
#include "Helpers.hpp"
#include "ListenSocket.hpp"
#include "netio3-backend/EventLoop/BaseEventLoop.hpp"
#include "netio3-backend/EventLoop/EventSignalHandle.hpp"
#include "netio3-backend/Netio3Backend.hpp"
namespace netio3::libfabric {
class ReceiveSocket : public BaseSocket
{
public:
ReceiveSocket(ListenSocket& lsocket, fid_fabric* fabric, DomainContext& domain, FiInfoUniquePtr&& info, BaseEventLoop* event_loop);
ReceiveSocket(const ReceiveSocket&) = delete;
ReceiveSocket(ReceiveSocket&&) = default;
ReceiveSocket& operator=(const ReceiveSocket&) = delete;
ReceiveSocket& operator=(ReceiveSocket&&) = default;
~ReceiveSocket();
[[nodiscard]] auto operator<=>(const ReceiveSocket& other) const
{
return get_endpoint().cqfd <=> other.get_endpoint().cqfd;
}
void post_buffers();
void post_buffer(Buffer* buf);
private:
[[nodiscard]] static Endpoint create_endpoint(const EndPointAddress& address,
fid_fabric* fabric,
fid_domain* domain,
FiInfoUniquePtr&& info);
static void open_cq(const EndPointAddress& address, Endpoint& ep, fid_domain* domain);
void init_buffers(DomainContext& domain);
[[nodiscard]] int do_post_buffer(Buffer* buf) const;
void retry_post_buffers();
[[nodiscard]] ConnectionParametersRecv prepare_connection_parameters(
const ConnectionParametersRecv& requested) const;
ConnectionParametersRecv m_conn_params{};
EndPointAddress m_address;
std::vector<Buffer> m_buffers;
std::vector<Buffer*> m_retry_post_buffers{};
EventSignalHandle m_retry_post_signal;
};
} // namespace netio3::libfabric
#endif // NETIO3BACKEND_BACKENDLIBFABRIC_RECEIVESOCKET_HPP