diff options
author | Erik Andersson <erik@packy.se> | 2016-11-22 23:56:43 +0100 |
---|---|---|
committer | Erik Andersson <erik@packy.se> | 2016-11-22 23:56:43 +0100 |
commit | 41954fffc10bfd230f857f57c6871b412d5f2e91 (patch) | |
tree | 010bcf28f294a58b4a22b7276cf615758648bcbe /src/user.h | |
parent | ed374a8dbcdaaf273964293d2805bdd61b148022 (diff) | |
download | ocelot-master.zip ocelot-master.tar.gz ocelot-master.tar.bz2 |
Diffstat (limited to 'src/user.h')
-rw-r--r-- | src/user.h | 40 |
1 files changed, 25 insertions, 15 deletions
@@ -1,23 +1,33 @@ +#ifndef USER_H +#define USER_H + +#include <atomic> +#include "ocelot.h" + class user { private: - int id; + userid_t id; + bool deleted; bool leechstatus; bool protect_ip; struct { - unsigned int leeching; - unsigned int seeding; + std::atomic<uint32_t> leeching; + std::atomic<uint32_t> seeding; } stats; public: - user(int uid, bool leech, bool protect); - int get_id(); - bool is_protected(); - void set_protected(bool status); - bool can_leech(); - void set_leechstatus(bool status); - void decr_leeching(); - void decr_seeding(); - void incr_leeching(); - void incr_seeding(); - unsigned int get_leeching(); - unsigned int get_seeding(); + user(userid_t uid, bool leech, bool protect); + userid_t get_id() { return id; } + bool is_deleted() { return deleted; } + void set_deleted(bool status) { deleted = status; } + bool is_protected() { return protect_ip; } + void set_protected(bool status) { protect_ip = status; } + bool can_leech() { return leechstatus; } + void set_leechstatus(bool status) { leechstatus = status; } + void decr_leeching() { --stats.leeching; } + void decr_seeding() { --stats.seeding; } + void incr_leeching() { ++stats.leeching; } + void incr_seeding() { ++stats.seeding; } + uint32_t get_leeching() { return stats.leeching; } + uint32_t get_seeding() { return stats.seeding; } }; +#endif |