Add check if connected and remove block list and removing of old data.

This commit is contained in:
2025-06-18 17:47:40 +02:00
parent 1516ad63cb
commit 31e8f302ac
5 changed files with 25 additions and 9 deletions

View File

@@ -89,11 +89,6 @@ BlockedList blockedList;
// When a new client connected:
void call(int sock, sockaddr_in newSocketInfo)
{
if (blockedList.isBlocked(newSocketInfo.sin_addr.s_addr))
{
TcpSocket::closet(sock);
return;
}
std::string add = TcpSocket::remoteAddress(newSocketInfo);
printf("new: %s\n", add.c_str());
int64_t conf, id;
@@ -106,7 +101,7 @@ void call(int sock, sockaddr_in newSocketInfo)
{
printf("StartHeader ERROR\n");
TcpSocket::closet(sock);
blockedList.addWarning(newSocketInfo.sin_addr.s_addr);
//blockedList.addWarning(newSocketInfo.sin_addr.s_addr);
return;
}
@@ -114,7 +109,7 @@ void call(int sock, sockaddr_in newSocketInfo)
{
printf("ID ERROR\n");
TcpSocket::closet(sock);
blockedList.addWarning(newSocketInfo.sin_addr.s_addr);
//blockedList.addWarning(newSocketInfo.sin_addr.s_addr);
return;
}
@@ -216,7 +211,7 @@ int main()
sql::init();
sql::create_tables();
blockedList.init();
std::thread t(checker);
//std::thread t(checker);
std::thread l(listen_key);
// Bind the server to a port.
int err = TcpSocket::listent("0.0.0.0", serverPort, call);