}
};
+class C_handle_connection_read : public EventCallback {
+ RDMAConnectedSocketImpl *csi;
+ bool active = true;
+ public:
+ explicit C_handle_connection_read(RDMAConnectedSocketImpl *w): csi(w) {}
+ void do_request(uint64_t fd) final {
+ if (active)
+ csi->handle_connection();
+ }
+ void close() {
+ active = false;
+ }
+};
#define dout_subsys ceph_subsys_ms
#undef dout_prefix
RDMAWorker *w)
: cct(cct), connected(0), error(0), ib(ib),
dispatcher(rdma_dispatcher), worker(w),
- is_server(false), con_handler(new C_handle_connection(this)),
+ is_server(false), read_handler(new C_handle_connection_read(this)),
established_handler(new C_handle_connection_established(this)),
active(false), pending(false)
{
}
return r;
}
- worker->center.create_file_event(tcp_fd, EVENT_READABLE, con_handler);
+ worker->center.create_file_event(tcp_fd, EVENT_READABLE, read_handler);
ldout(cct, 20) << __func__ << " finish " << dendl;
return 0;
}
}
void RDMAConnectedSocketImpl::cleanup() {
- if (con_handler && tcp_fd >= 0) {
- (static_cast<C_handle_connection*>(con_handler))->close();
+ if (read_handler && tcp_fd >= 0) {
+ (static_cast<C_handle_connection_read*>(read_handler))->close();
worker->center.submit_to(worker->center.get_id(), [this]() {
worker->center.delete_file_event(tcp_fd, EVENT_READABLE | EVENT_WRITABLE);
}, false);
- delete con_handler;
- con_handler = nullptr;
+ delete read_handler;
+ read_handler = nullptr;
}
if (established_handler) {
(static_cast<C_handle_connection_established*>(established_handler))->close();
tcp_fd = sd;
is_server = true;
worker->center.submit_to(worker->center.get_id(), [this]() {
- worker->center.create_file_event(tcp_fd, EVENT_READABLE, con_handler);
+ worker->center.create_file_event(tcp_fd, EVENT_READABLE, read_handler);
}, true);
}
ceph::mutex lock = ceph::make_mutex("RDMAConnectedSocketImpl::lock");
std::vector<ibv_wc> wc;
bool is_server;
- EventCallbackRef con_handler;
+ EventCallbackRef read_handler;
EventCallbackRef established_handler;
int tcp_fd = -1;
bool active;// qp is active ?
void set_pending(bool val) {pending = val;}
void post_chunks_to_rq(int num);
void update_post_backlog();
-
- class C_handle_connection : public EventCallback {
- RDMAConnectedSocketImpl *csi;
- bool active;
- public:
- explicit C_handle_connection(RDMAConnectedSocketImpl *w): csi(w), active(true) {}
- void do_request(uint64_t fd) {
- if (active)
- csi->handle_connection();
- }
- void close() {
- active = false;
- }
- };
-
};
enum RDMA_CM_STATUS {