plebble
clients.h
Go to the documentation of this file.
1 /*
2 -------------------------------------------------------------------------------
3  PLEBBLE
4 -------------------------------------------------------------------------------
5  Copyright (C) 2019-2020 KATLAS Technology. (http://katlastechnology.com)
6  Copyright (C) 2017-2020 Marcos Mayorga. (mm@mm-studios.com)
7 
8  This file is part of our Plebble(R) Platform.
9 
10  The code below cannot be copied, used for any purpose other than the one
11  agreed and/or distributed without the express permission of
12  KATLAS Technology.
13 -------------------------------------------------------------------------------
14 
15 
16 */
17 #ifndef USGOV_805e6ee810375a936b2b9f95654d0ec0ac9d4f0da47ead6333cc783d44fe4a0c
18 #define USGOV_805e6ee810375a936b2b9f95654d0ec0ac9d4f0da47ead6333cc783d44fe4a0c
19 
20 #include "gc.h"
21 #include <us/gov/bgtask.h>
22 #include <unordered_map>
23 #include <vector>
24 #include "client.h"
25 
26 namespace us { namespace gov {
27 namespace socket {
28 
29  struct server;
30  struct client;
31 
32  struct clients_t final: unordered_map<int,client*> { //neighbour ring
33  typedef unordered_map<int,client*> b;
36  clients_t(const clients_t& other)=delete;
38  void add(client*);
40  void update(vector<int>& honest, vector<pair<uint32_t,string>>& evil);
41  void dump(const string& prefix, ostream& os) const;
42  ko start();
43  ko wait_ready(const chrono::system_clock::time_point& deadline) const;
44  inline void stop() { gc.stop(); }
45  inline void join() { gc.join(); }
46  void feedlo();
47  mutable mutex mx;
51  };
52 
53 }
54 }}
55 
56 #endif
57 
us::gov::socket::clients_t::add_update
void add_update(client *)
us::gov::socket::clients_t::gc
gc_t gc
Definition: clients.h:49
us::gov::socket::clients_t::mx
mutex mx
Definition: clients.h:47
us::gov::socket::clients_t::join
void join()
Definition: clients.h:45
bgtask.h
gc.h
us::gov::socket::client
Definition: client.h:44
us.ko
Definition: ko.java:20
us
Definition: daemon.h:22
unlikely
#define unlikely(x)
Definition: likely.h:30
us::gov::socket::clients_t::locli
client locli
Definition: clients.h:48
us::gov::socket::clients_t::clients_t
clients_t(const clients_t &other)=delete
us::gov::socket::clients_t::add
void add(client *)
us::gov::socket::clients_t::update
void update(vector< int > &honest, vector< pair< uint32_t, string >> &evil)
us::gov::bgtask::stop
virtual void stop()
c
us::gov::socket::clients_t c
Definition: clients.cpp:26
us::gov::socket::clients_t::gc_t
us::gov::socket::gc_t gc_t
Definition: clients.h:34
us::gov::socket
Definition: busyled.h:23
us::gov::socket::clients_t::stop
void stop()
Definition: clients.h:44
us::gov::socket::clients_t::feedlo
void feedlo()
us::gov::socket::clients_t::b
unordered_map< int, client * > b
Definition: clients.h:33
us::gov::socket::clients_t
Definition: clients.h:32
us::gov::bgtask::join
virtual void join()
us::gov::socket::server
Definition: server.h:45
c
Definition: client.cpp:417
us::gov::socket::clients_t::clients_t
clients_t(server *s)
likely
#define likely(x)
Definition: likely.h:29
std
Definition: app.h:380
us::gov::socket::clients_t::svr
server * svr
Definition: clients.h:50
config.h
us::gov::socket::clients_t::~clients_t
~clients_t()
us::gov::socket::gc_t
Definition: gc.h:30
us::gov::socket::clients_t::dump
void dump(const string &prefix, ostream &os) const
server.h
clients.h
us.pair
Definition: pair.java:19
gov.h
client.h
log
#define log
Definition: gov.h:83
us::gov::socket::clients_t::wait_ready
ko wait_ready(const chrono::system_clock::time_point &deadline) const
us::gov::socket::clients_t::start
ko start()