mirror of
https://github.com/CPunch/Laika.git
synced 2025-10-14 19:40:24 +00:00
Added laikaP_pushOutQueue, minor refactoring
- sLaika_pollList now holds an outQueue, if events are sent to a peer, the pollList will keep track so the caller (cnc, bot, etc) can handle each pollOut for the queued peers.
This commit is contained in:
@@ -16,8 +16,11 @@ struct sLaika_pollEvent {
|
||||
bool pollOut;
|
||||
};
|
||||
|
||||
struct sLaika_peer;
|
||||
|
||||
struct sLaika_pollList {
|
||||
struct hashmap *sockets;
|
||||
struct sLaika_peer **outQueue; /* holds peers which have data needed to be sent */
|
||||
struct sLaika_pollEvent *revents;
|
||||
#ifdef LAIKA_USE_EPOLL
|
||||
/* epoll */
|
||||
@@ -29,8 +32,10 @@ struct sLaika_pollList {
|
||||
int fdCapacity;
|
||||
int fdCount;
|
||||
#endif
|
||||
int reventCapacity;
|
||||
int reventCap;
|
||||
int reventCount;
|
||||
int outCap;
|
||||
int outCount;
|
||||
};
|
||||
|
||||
void laikaP_initPList(struct sLaika_pollList *pList);
|
||||
@@ -40,6 +45,8 @@ void laikaP_rmvSock(struct sLaika_pollList *pList, struct sLaika_socket *sock);
|
||||
void laikaP_addPollOut(struct sLaika_pollList *pList, struct sLaika_socket *sock);
|
||||
void laikaP_rmvPollOut(struct sLaika_pollList *pList, struct sLaika_socket *sock);
|
||||
void laikaP_iterList(struct sLaika_pollList *pList, tLaika_pollIter iter, void *uData);
|
||||
void laikaP_pushOutQueue(struct sLaika_pollList *pList, struct sLaika_peer *peer);
|
||||
void laikaP_resetOutQueue(struct sLaika_pollList *pList);
|
||||
|
||||
struct sLaika_pollEvent *laikaP_poll(struct sLaika_pollList *pList, int timeout, int *nevents);
|
||||
|
||||
|
Reference in New Issue
Block a user