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

Method OnComplete

library/cpp/netliba/v6/ib_cs.cpp:472–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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