Skip to content

Commit

Permalink
1kw test passed
Browse files Browse the repository at this point in the history
  • Loading branch information
yedf committed Aug 22, 2015
1 parent f10f837 commit bc5a17c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/1kw-cli.cc
Original file line number Diff line number Diff line change
@@ -57,15 +57,15 @@ int main(int argc, const char* argv[]) {
con->send(buf, bsz);
send++;
recved ++;
} else if (!bsz && con->getInput().size() == sizeof heartbeat) {
} else if (heartbeat_interval && con->getInput().size() >= sizeof heartbeat) {
con->getInput().clear();
recved ++;
}
});
con->onState([i, &statecb](const TcpConnPtr& con){statecb(con, i);});
allConns[i] = con;
if ((i+1) % 5000 == 0) {
info("%d connection created", i+1);
usleep(200*1000);
}
}
int last_send = 0;
@@ -74,11 +74,11 @@ int main(int argc, const char* argv[]) {
(send - last_send) / 3, send, connected, conn_count - connected, retry, recved);
last_send = send;
}, 3000);
if (bsz == 0) {
if (heartbeat_interval) {
base.runAfter(heartbeat_interval * 1000, [&] {
for(size_t i = 0; i < allConns.size(); i ++) {
if (allConns[i]->getState() == TcpConn::Connected) {
allConns[i]->send("heartbeat");
allConns[i]->send(heartbeat, sizeof heartbeat);
send++;
}
}

0 comments on commit bc5a17c

Please sign in to comment.