avoid passing stack vars by reference in callbacks

master
Francisco Paisana 5 years ago
parent e8487211e4
commit 151159e2c6

@ -246,7 +246,7 @@ void enb_stack_lte::remove_mme_socket(int fd)
void enb_stack_lte::add_gtpu_s1u_socket_handler(int fd) void enb_stack_lte::add_gtpu_s1u_socket_handler(int fd)
{ {
auto gtpu_s1u_handler = [this](srslte::unique_byte_buffer_t pdu, const sockaddr_in& from) { auto gtpu_s1u_handler = [this](srslte::unique_byte_buffer_t pdu, const sockaddr_in& from) {
auto task_handler = [this, &from](task_t* t) { gtpu.handle_gtpu_s1u_rx_packet(std::move(t->pdu), from); }; auto task_handler = [this, from](task_t* t) { gtpu.handle_gtpu_s1u_rx_packet(std::move(t->pdu), from); };
pending_tasks.push(gtpu_queue_id, task_t{task_handler, std::move(pdu)}); pending_tasks.push(gtpu_queue_id, task_t{task_handler, std::move(pdu)});
}; };
rx_sockets->add_socket_pdu_handler(fd, gtpu_s1u_handler); rx_sockets->add_socket_pdu_handler(fd, gtpu_s1u_handler);
@ -255,7 +255,7 @@ void enb_stack_lte::add_gtpu_s1u_socket_handler(int fd)
void enb_stack_lte::add_gtpu_m1u_socket_handler(int fd) void enb_stack_lte::add_gtpu_m1u_socket_handler(int fd)
{ {
auto gtpu_m1u_handler = [this](srslte::unique_byte_buffer_t pdu, const sockaddr_in& from) { auto gtpu_m1u_handler = [this](srslte::unique_byte_buffer_t pdu, const sockaddr_in& from) {
auto task_handler = [this, &from](task_t* t) { gtpu.handle_gtpu_m1u_rx_packet(std::move(t->pdu), from); }; auto task_handler = [this, from](task_t* t) { gtpu.handle_gtpu_m1u_rx_packet(std::move(t->pdu), from); };
pending_tasks.push(gtpu_queue_id, task_t{task_handler, std::move(pdu)}); pending_tasks.push(gtpu_queue_id, task_t{task_handler, std::move(pdu)});
}; };
rx_sockets->add_socket_pdu_handler(fd, gtpu_m1u_handler); rx_sockets->add_socket_pdu_handler(fd, gtpu_m1u_handler);

Loading…
Cancel
Save