must be called only after success aquiring output
| 1387 | |
| 1388 | //must be called only after success aquiring output |
| 1389 | void SendMessages(bool asioThread) { |
| 1390 | DBGOUT("TServer::SendMessages(enter)"); |
| 1391 | try { |
| 1392 | do { |
| 1393 | NeedCheckOutputQueue_.store(false); |
| 1394 | TAutoPtr<TOutputData> d; |
| 1395 | while (OutputData_.Dequeue(&d)) { |
| 1396 | d->MoveTo(OutputBuffers_); |
| 1397 | if (!OutputBuffers_.HasFreeSpace()) { |
| 1398 | if (!FlushOutputBuffers(asioThread)) { |
| 1399 | return; |
| 1400 | } |
| 1401 | } |
| 1402 | } |
| 1403 | |
| 1404 | if (OutputBuffers_.HasData()) { |
| 1405 | if (!FlushOutputBuffers(asioThread)) { |
| 1406 | return; |
| 1407 | } |
| 1408 | } |
| 1409 | |
| 1410 | OutputLock_.Release(); |
| 1411 | |
| 1412 | if (!NeedCheckOutputQueue_.load()) { |
| 1413 | DBGOUT("Server::SendMessages(exit2): " << (int)!OutputLock_.IsLocked()); |
| 1414 | return; |
| 1415 | } |
| 1416 | } while (OutputLock_.TryAcquire()); |
| 1417 | DBGOUT("Server::SendMessages(exit1)"); |
| 1418 | } catch (...) { |
| 1419 | OnError(); |
| 1420 | } |
| 1421 | } |
| 1422 | |
| 1423 | bool FlushOutputBuffers(bool asioThread) { |
| 1424 | DBGOUT("FlushOutputBuffers: cnt=" << OutputBuffers_.GetIOvec()->Count() << " c=" << (size_t)this); |
nothing calls this directly
no test coverage detected