MCPcopy Create free account
hub / github.com/catboost/catboost / OnComplete

Method OnComplete

library/cpp/netliba/v12/ib_cs.cpp:481–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479 }
480 }
481 void OnComplete(ibv_wc* wc, NHPTimer::STime tCurrent) {
482 TIBPeer* peer = GetChannelByQPN(wc->qp_num);
483 if (peer) {
484 if (!peer->OutMsgs.empty()) {
485 peer->LastRecv = tCurrent;
486 if (wc->status != IBV_WC_SUCCESS) {
487 //printf("completed with status %d\n", wc->status);
488 PeerFailed(peer);
489 } else {
490 const TCompleteInfo& cc = peer->OutMsgs.front();
491 switch (cc.Type) {
492 case TCompleteInfo::CI_DATA_TINY:
493 //printf("Completed data_tiny\n");
494 SendCompleted(peer, cc.MsgHandle);
495 break;
496 case TCompleteInfo::CI_RDMA_COMPLETE:
497 //printf("Completed rdma_complete\n");
498 {
499 TDeque<TQueuedSend>::iterator z = peer->GetSend(cc.MsgHandle);
500 TQueuedSend& qs = *z;
501
502 TCmdDataComplete complete;
503 complete.Command = CMD_DATA_COMPLETE;
504 complete.PacketGuid = qs.PacketGuid;
505#ifdef _DEBUG
506 complete.DataHash = MurmurHash<ui64>(qs.MemBlock->GetData(), qs.MemBlock->GetSize());
507#else
508 complete.DataHash = 0;
509#endif
510
511 peer->PostSend(BP, &complete, sizeof(complete), TCompleteInfo::CI_DATA_SENT, qs.MsgHandle);
512 //printf("Send CMD_DATA_COMPLETE\n");
513 }
514 break;
515 case TCompleteInfo::CI_DATA_SENT:
516 //printf("Completed data_sent\n");
517 {
518 TDeque<TQueuedSend>::iterator z = peer->GetSend(cc.MsgHandle);
519 TIBMsgHandle msgHandle = z->MsgHandle;
520 peer->SendQueue.erase(z);
521 SendCompleted(peer, msgHandle);
522 }
523 break;
524 case TCompleteInfo::CI_KEEP_ALIVE:
525 break;
526 case TCompleteInfo::CI_IGNORE:
527 //printf("Completed ignored\n");
528 break;
529 default:
530 Y_ASSERT(0);
531 break;
532 }
533 peer->OutMsgs.pop_front();
534 BP.FreeBuf(wc->wr_id);
535 }
536 } else {
537 Y_ABORT_UNLESS(0, "got completion without outstanding messages");
538 }

Callers

nothing calls this directly

Calls 9

pop_frontMethod · 0.80
emptyMethod · 0.45
frontMethod · 0.45
GetSendMethod · 0.45
GetDataMethod · 0.45
GetSizeMethod · 0.45
PostSendMethod · 0.45
eraseMethod · 0.45
FreeBufMethod · 0.45

Tested by

no test coverage detected