MCPcopy Create free account
hub / github.com/MonaSolutions/MonaServer / flush

Method flush

MonaBase/sources/Socket.cpp:421–442  ·  view source on GitHub ↗

Is called from one other thread than main thread (by the manager socket thread, so here socket is necessary managed, and _sockfd is good)

Source from the content-addressed store, hash-verified

419
420 // Is called from one other thread than main thread (by the manager socket thread, so here socket is necessary managed, and _sockfd is good)
421 bool flush(Exception& ex) {
422 ASSERT_RETURN(_initialized, false);
423 lock_guard<recursive_mutex> lock(_mutexManaged);
424 if (!_pManagedSocket)
425 return true; // mean no Senders queue!!
426 lock_guard<mutex> lockAsync(_mutexAsync);
427 while (!_senders.empty()) {
428 shared_ptr<SocketSender>& pSender(_senders.front());
429 _mutexAsync.unlock();
430 if (!pSender->flush(ex,*_pSocket)) {
431 _mutexAsync.lock();
432 if (!_writing)
433 _writing = manager.startWrite(_sockfd,_pManagedSocket);
434 return false;
435 }
436 _mutexAsync.lock();
437 _senders.pop_front();
438 }
439 if (_writing)
440 _writing = !manager.stopWrite(_sockfd,_pManagedSocket);
441 return true;
442 }
443
444
445 bool managed(Exception& ex) {

Callers

nothing calls this directly

Calls 7

frontMethod · 0.80
unlockMethod · 0.80
lockMethod · 0.80
startWriteMethod · 0.80
stopWriteMethod · 0.80
emptyMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected