diff --git a/components/net/cpp/src/peer.cpp b/components/net/cpp/src/peer.cpp index 07deffe3897bf1ed809bb220cd578c437e81aa28..c32d627835d912502f78bffb1886338db092267c 100644 --- a/components/net/cpp/src/peer.cpp +++ b/components/net/cpp/src/peer.cpp @@ -401,7 +401,12 @@ void Peer::data() { return; } - int rc = ftl::net::internal::recv(sock_, recv_buf_.buffer(), recv_buf_.buffer_capacity(), 0); + int cap = recv_buf_.buffer_capacity(); + int rc = ftl::net::internal::recv(sock_, recv_buf_.buffer(), cap, 0); + + if (rc >= cap) { + LOG(WARNING) << "More than buffers worth of data received"; + } if (rc <= 0) { return; @@ -410,6 +415,8 @@ void Peer::data() { recv_buf_.buffer_consumed(rc); lk.unlock(); + LOG(INFO) << "Received " << rc << " bytes"; + pool.push([](int id, Peer *p) { p->_data(); //p->is_waiting_ = true; diff --git a/components/net/cpp/src/universe.cpp b/components/net/cpp/src/universe.cpp index af510a71038b486325a79b7744471dcbb068c817..1a7e808a158b6ab30f33e08ec2c07ca80294f43a 100644 --- a/components/net/cpp/src/universe.cpp +++ b/components/net/cpp/src/universe.cpp @@ -141,9 +141,9 @@ int Universe::_setDescriptors() { n = s->_socket(); } - if (s->isWaiting()) { + //if (s->isWaiting()) { FD_SET(s->_socket(), &sfdread_); - } + //} FD_SET(s->_socket(), &sfderror_); } } @@ -323,6 +323,7 @@ void Universe::_run() { continue; } + // CHECK Could this mutex be the problem!? unique_lock<shared_mutex> lk(net_mutex_); //If connection request is waiting