Skip to content
Snippets Groups Projects
Commit b0eeda9e authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Code tidy and notes

parent c339ade3
No related branches found
No related tags found
1 merge request!37Resolves #83 net performance, partially
Pipeline #11556 passed
......@@ -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;
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment