| 495 | }; |
| 496 | |
| 497 | inline void ExecuteRecv() { |
| 498 | SetHighestThreadPriority(); |
| 499 | |
| 500 | TInFly infly; |
| 501 | |
| 502 | while (true) { |
| 503 | TPacketRef p = Recv(); |
| 504 | |
| 505 | switch (static_cast<EPacketType>(p->Type())) { |
| 506 | case PT_REQUEST: |
| 507 | if (CB_) { |
| 508 | CB_->OnRequest(new TRequest(*p, this)); |
| 509 | } else { |
| 510 | //skip request in case of client |
| 511 | } |
| 512 | |
| 513 | break; |
| 514 | |
| 515 | case PT_RESPONSE: { |
| 516 | CancelStaleRequests(infly); |
| 517 | |
| 518 | TResponsePacket<TString> rp(*p); |
| 519 | |
| 520 | TInFly::TIter it = static_cast<TInFlyBase&>(infly).find(rp.Guid); |
| 521 | |
| 522 | if (it == static_cast<TInFlyBase&>(infly).end()) { |
| 523 | break; |
| 524 | } |
| 525 | |
| 526 | const TRequestDescrRef& d = it->second; |
| 527 | d->Hndl->NotifyResponse(rp.Data); |
| 528 | |
| 529 | infly.erase(it); |
| 530 | |
| 531 | break; |
| 532 | } |
| 533 | |
| 534 | case PT_STOP: |
| 535 | Schedule(nullptr); |
| 536 | |
| 537 | return; |
| 538 | |
| 539 | case PT_TIMEOUT: |
| 540 | CancelStaleRequests(infly); |
| 541 | |
| 542 | break; |
| 543 | } |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | inline void ExecuteSend() { |
| 548 | SetHighestThreadPriority(); |
nothing calls this directly
no test coverage detected