git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replcae GetStore with new GetPlugin method from plugin creator
[stg.git]
/
projects
/
sgauthstress
/
proto.h
diff --git
a/projects/sgauthstress/proto.h
b/projects/sgauthstress/proto.h
index 879e7a35b11a49e3a367842a7de31705bb6429ac..543ae9e71b114c8ecb064c077364160eae9243f2 100644
(file)
--- a/
projects/sgauthstress/proto.h
+++ b/
projects/sgauthstress/proto.h
@@
-6,6
+6,8
@@
#include <poll.h>
#include <string>
#include <poll.h>
#include <string>
+#include <list>
+#include <vector>
#include <map>
#include "stg/os_int.h"
#include <map>
#include "stg/os_int.h"
@@
-30,23
+32,26
@@
class PROTO {
const std::string GetStrError() const { return errorStr; }
const std::string GetStrError() const { return errorStr; }
- void AddUser(const USER & user);
+ void AddUser(const USER & user
, bool connect = false
);
bool Connect(uint32_t ip);
bool Disconnect(uint32_t ip);
bool Connect(uint32_t ip);
bool Disconnect(uint32_t ip);
+
+ size_t UserCount() const { return users.size(); }
private:
BLOWFISH_CTX ctx;
struct sockaddr_in localAddr;
struct sockaddr_in serverAddr;
int timeout;
private:
BLOWFISH_CTX ctx;
struct sockaddr_in localAddr;
struct sockaddr_in serverAddr;
int timeout;
- std::
map<uint32_t, USER
> users;
+ std::
list<std::pair<uint32_t, USER>
> users;
std::vector<struct pollfd> pollFds;
bool running;
bool stopped;
pthread_t tid;
std::vector<struct pollfd> pollFds;
bool running;
bool stopped;
pthread_t tid;
+ pthread_mutex_t mutex;
std::string errorStr;
std::string errorStr;
@@
-55,9
+60,10
@@
class PROTO {
static void * Runner(void * data);
void Run();
static void * Runner(void * data);
void Run();
+ void CheckTimeouts();
bool RecvPacket();
bool SendPacket(const void * buffer, size_t length, USER * user);
bool RecvPacket();
bool SendPacket(const void * buffer, size_t length, USER * user);
- bool HandlePacket(const char * buffer, USER * user);
+ bool HandlePacket(const char * buffer,
size_t length,
USER * user);
bool CONN_SYN_ACK_Proc(const void * buffer, USER * user);
bool ALIVE_SYN_Proc(const void * buffer, USER * user);
bool CONN_SYN_ACK_Proc(const void * buffer, USER * user);
bool ALIVE_SYN_Proc(const void * buffer, USER * user);
@@
-71,6
+77,9
@@
class PROTO {
bool Send_DISCONN_SYN(USER * user);
bool Send_DISCONN_ACK(USER * user);
bool Send_ALIVE_ACK(USER * user);
bool Send_DISCONN_SYN(USER * user);
bool Send_DISCONN_ACK(USER * user);
bool Send_ALIVE_ACK(USER * user);
+
+ bool RealConnect(USER * user);
+ bool RealDisconnect(USER * user);
};
#endif
};
#endif