forked from tjjh89017/ezio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.hpp
43 lines (36 loc) · 966 Bytes
/
service.hpp
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
36
37
38
39
40
41
42
43
#ifndef __SERVICE_HPP__
#define __SERVICE_HPP__
#include <iostream>
#include <sstream>
#include <vector>
#include <libtorrent/session.hpp>
#include <libtorrent/torrent_handle.hpp>
#include <libtorrent/torrent_status.hpp>
#include <grpc++/grpc++.h>
#include "ezio.grpc.pb.h"
using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerContext;
using grpc::Status;
using ezio::Torrent;
using ezio::UpdateStatus;
using ezio::UpdateRequest;
using ezio::EZIO;
namespace lt = libtorrent;
class EZIOServiceImpl final : public EZIO::Service {
public:
EZIOServiceImpl(lt::session &tmp);
virtual Status GetTorrentStatus(ServerContext* context, const UpdateRequest* request, UpdateStatus* status) override;
lt::session &ses;
};
void grpc_start(lt::session&);
class gRPCService {
public:
gRPCService(lt::session&);
//void start();
void stop();
std::string server_address = "0.0.0.0:50051";
EZIOServiceImpl service;
std::unique_ptr<Server> server;
};
#endif