-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
35 lines (25 loc) · 805 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#define FUSE_USE_VERSION 31
#include <fuse.h>
#include "pinger.hpp"
#include "pingdrive.hpp"
#include <iostream>
#include <fstream>
#include <thread>
int main(int argc, char* argv[])
{
for (int i = 0; i <= 3; i++)
{
std::ifstream ipListFile("IPs-" + std::to_string(i) + ".txt");
pingloop::p.populate_map(ipListFile);
}
// This runs the timers
boost::asio::io_service::work work(pingloop::io_service);
std::thread io_thread([&] { pingloop::io_service.run(); });
// This runs the network receive->send loop.
std::thread run_thread([&] { pingloop::p.start_receive_loop(); });
// This runs the virual filesystem, and blocks
fuse_main(argc, argv, &pingloop::drive::operations, NULL);
pingloop::p.stop_receive_loop();
run_thread.join();
pingloop::drive::clean_up();
}