Skip to content

Commit f8950cd

Browse files
committed
Bug fix: Client isnt removed when timeout
1 parent 43a52a2 commit f8950cd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cqsocketapi/APIClient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ void APIClient::add(const int port)
6565

6666
void APIClient::send(const char *buffer, const int len)
6767
{
68-
time_t timeout = time(0) + CLIENT_TIMEOUT;
68+
time_t timeout = time(0) - CLIENT_TIMEOUT;
6969
char log[1024];
7070

7171
for (int i = 0; i < CLIENT_SIZE; i++) {
7272
if (clients[i].hello < 0) {
7373
continue;
7474
}
75-
if (clients[i].hello > timeout) {
75+
if (clients[i].hello < timeout) {
7676
clients[i].hello = -1;
7777
sprintf_s(log, "Client removed: %d.", clients[i].port);
7878
CQ_addLog(appAuthCode, CQLOG_INFO, "APIClient", log);

cqsocketapi/org.dazzyd.cqsocketapi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"ret":1,
33
"apiver":9,
44
"appid":"org.dazzyd.cqsocketapi",
5-
"name":"CoolQ Scoket API",
6-
"version":"2.0.0",
5+
"name":"CoolQ Socket API",
6+
"version":"2.0.1",
77
"version_id":1,
88
"author":"Dazzy Ding",
99
"description":"CoolQ Scoket API",

0 commit comments

Comments
 (0)