small change
This commit is contained in:
parent
1095da2bea
commit
f8e00791c1
2 changed files with 3 additions and 2 deletions
|
@ -72,7 +72,7 @@ int main (int /*argc*/, const char * /*argv*/[]) {
|
||||||
epoll_ctl (myEpoll, EPOLL_CTL_ADD, server.fd(), &wakeSeasocks);
|
epoll_ctl (myEpoll, EPOLL_CTL_ADD, server.fd(), &wakeSeasocks);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
constexpr auto maxEvents = 2;
|
constexpr auto maxEvents = 10;
|
||||||
epoll_event events[maxEvents];
|
epoll_event events[maxEvents];
|
||||||
auto res = epoll_wait (myEpoll, events, maxEvents, -1);
|
auto res = epoll_wait (myEpoll, events, maxEvents, -1);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ bool WsClient::start() {
|
||||||
printf ("Port %s opened (%d)\r\n", name, fd);
|
printf ("Port %s opened (%d)\r\n", name, fd);
|
||||||
usleep (1000);
|
usleep (1000);
|
||||||
running = true;
|
running = true;
|
||||||
return true;
|
return running;
|
||||||
}
|
}
|
||||||
void WsClient::stop() {
|
void WsClient::stop() {
|
||||||
cout << "Client Stop\n";
|
cout << "Client Stop\n";
|
||||||
|
@ -263,6 +263,7 @@ void WsClient::send_trig_mode() {
|
||||||
write (buffer, r);
|
write (buffer, r);
|
||||||
}
|
}
|
||||||
int WsClient::write(const char * data, const int len) {
|
int WsClient::write(const char * data, const int len) {
|
||||||
|
if (!running) return 0;
|
||||||
string out (data, len);
|
string out (data, len);
|
||||||
cout << out;
|
cout << out;
|
||||||
int r = ::write (fd, data, len);
|
int r = ::write (fd, data, len);
|
||||||
|
|
Loading…
Reference in a new issue