Skip to content

Commit

Permalink
netlink: improved event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmm committed Sep 10, 2024
1 parent 2b62f2c commit bf8a601
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
16 changes: 0 additions & 16 deletions src/fastgame_apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ptree_fwd.hpp>
#include <chrono>
#include <cstdint>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <memory>
#include <string>
#include <thread>
Expand Down Expand Up @@ -344,21 +342,7 @@ auto main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) -> int {

// nl->new_exit.connect([&](int pid) {});

// auto check_lock_file = [&]() {
// while (std::filesystem::is_regular_file(input_file)) {
// std::this_thread::sleep_for(std::chrono::seconds(1));
// }

// util::info("The lock file has been removed. Exitting the lock thread.");

// nl->listen = false;
// };

if (nl->listen) {
// std::thread t(check_lock_file);

// t.detach();

nl->handle_events(); // This is a blocking call. It has to be started at the end

util::info("Netlink event monitor finished.");
Expand Down
2 changes: 1 addition & 1 deletion src/netlink_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
C compiler...
*/

void prepare_iovec(struct iovec* iov) {
void prepare_iovec(struct iovec iov[3]) {
char buff[NLMSG_LENGTH(0)];
struct cn_msg cnmsg;
enum proc_cn_mcast_op mcast_op = PROC_CN_MCAST_LISTEN;
Expand Down
2 changes: 1 addition & 1 deletion src/netlink_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct fg_cn_msg {
enum fg_proc_cn_event event;
};

void prepare_iovec(struct iovec* iov);
void prepare_iovec(struct iovec iov[3]);

struct fg_cn_msg parse_cn_msg(struct cn_msg* msg);

Expand Down

0 comments on commit bf8a601

Please sign in to comment.