1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-10-04 15:20:07 +00:00

Added panel!

- minor refactoring
- TODO: panel & cnc should really use unique keys. maybe add config file?
This commit is contained in:
2022-02-14 00:22:36 -06:00
parent e7265ad15b
commit fb71dfb3c3
13 changed files with 1003 additions and 6 deletions

View File

@@ -77,9 +77,18 @@ void laikaP_addSock(struct sLaika_pollList *pList, struct sLaika_socket *sock) {
}
void laikaP_rmvSock(struct sLaika_pollList *pList, struct sLaika_socket *sock) {
int i;
/* remove socket from hashmap */
hashmap_delete(pList->sockets, &(tLaika_hashMapElem){.fd = sock->sock, .sock = sock});
/* make sure peer isn't in outQueue */
for (i = 0; i < pList->outCount; i++) {
if ((void*)pList->outQueue[i] == (void*)sock) {
laikaM_rmvarray(pList->outQueue, pList->outCount, i, 1);
}
}
#ifdef LAIKA_USE_EPOLL
/* epoll_event* isn't needed with EPOLL_CTL_DEL, however we still need to pass a NON-NULL pointer. [see: https://man7.org/linux/man-pages/man2/epoll_ctl.2.html#BUGS] */
if (epoll_ctl(pList->epollfd, EPOLL_CTL_DEL, sock->sock, &pList->ev) == -1) {