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

Code tidy, still has bug on close

parent 49b52a97
No related branches found
No related tags found
1 merge request!37Resolves #83 net performance, partially
Pipeline #11572 passed
......@@ -320,8 +320,6 @@ int Peer::asyncCall(
ARGS... args) {
auto args_obj = std::make_tuple(args...);
auto rpcid = 0;
LOG(INFO) << "RPC " << name << "() -> " << uri_;
{
// Could this be the problem????
......@@ -331,6 +329,8 @@ int Peer::asyncCall(
callbacks_[rpcid] = std::make_unique<caller<T>>(cb);
}
LOG(INFO) << "RPC " << name << "(" << rpcid << ") -> " << uri_;
auto call_obj = std::make_tuple(0,rpcid,name,args_obj);
UNIQUE_LOCK(send_mtx_,lk);
......
......@@ -409,9 +409,11 @@ void Peer::data() {
}
if (cap < (kMaxMessage / 10)) LOG(WARNING) << "NO BUFFER";
if (rc <= 0) {
//LOG(WARNING) << "Weird rc: " << rc;
//close();
if (rc == 0) {
close();
return;
} else if (rc < 0) {
socketError();
return;
}
......@@ -427,7 +429,7 @@ void Peer::data() {
}
lk.unlock();
LOG(INFO) << "Received " << rc << " bytes";
//LOG(INFO) << "Received " << rc << " bytes";
}
bool Peer::_data() {
......@@ -443,8 +445,6 @@ bool Peer::_data() {
msgpack::object_handle msg;
while (recv_buf_.next(msg)) {
// CHECK Safe to unlock here?
lk.unlock();
ws_read_header_ = false;
msgpack::object obj = msg.get();
if (status_ != kConnected) {
......@@ -464,10 +464,14 @@ bool Peer::_data() {
return false;
}
}
disp_->dispatch(*this, obj);
// CHECK Safe to unlock here?
is_waiting_ = true;
lk.unlock();
disp_->dispatch(*this, obj);
// Relock before next loop of while
lk.lock();
is_waiting_ = false;
if (scheme_ == ftl::URI::SCHEME_WS && recv_buf_.nonparsed_size() > 0) {
wsheader_type ws;
......
......@@ -64,8 +64,6 @@ NetSource::~NetSource() {
void NetSource::_recv(const vector<unsigned char> &jpg, const vector<unsigned char> &d) {
cv::Mat tmp_rgb, tmp_depth;
DLOG(INFO) << "Received frame";
// Decode in temporary buffers to prevent long locks
cv::imdecode(jpg, cv::IMREAD_COLOR, &tmp_rgb);
cv::imdecode(d, cv::IMREAD_UNCHANGED, &tmp_depth);
......
......@@ -170,7 +170,7 @@ void Streamer::poll() {
if (elapsed.count() >= wait) {
LOG(WARNING) << "Frame rate below optimal @ " << (1.0f / elapsed.count());
} else {
LOG(INFO) << "Frame rate @ " << (1.0f / elapsed.count());
//LOG(INFO) << "Frame rate @ " << (1.0f / elapsed.count());
// Otherwise, wait until next frame should start.
// CHECK(Nick) Is this accurate enough? Almost certainly not
// TODO(Nick) Synchronise by time corrections and use of fixed time points
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment