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

Method ConnectPeer

library/cpp/netliba/v6/ib_cs.cpp:691–738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689 return rv;
690 }
691 IIBPeer* ConnectPeer(const TIBConnectInfo& info, const TUdpAddress& peerAddr, const TUdpAddress& myAddr) override {
692 for (auto& channel : Channels) {
693 TIntrusivePtr<TIBPeer> peer = channel.second;
694 if (peer->PeerAddress == peerAddr) {
695 return peer.Get();
696 }
697 }
698 TIntrusivePtr<TRCQueuePair> rcQP;
699 rcQP = new TRCQueuePair(Port->GetCtx(), CQ, BP.GetSRQ(), QP_SEND_QUEUE_SIZE);
700
701 int qpn = rcQP->GetQPN();
702 Y_ASSERT(Channels.find(qpn) == Channels.end());
703 TIntrusivePtr<TIBPeer>& peer = Channels[qpn];
704 peer = new TIBPeer(peerAddr, rcQP);
705
706 TCmdHandshake handshake;
707 handshake.Command = CMD_HANDSHAKE;
708 handshake.PSN = rcQP->GetPSN();
709 handshake.QPN = rcQP->GetQPN();
710 handshake.SocketId = info.SocketId;
711 handshake.MyAddress = myAddr;
712
713 TIntrusivePtr<TAddressHandle> serverAH;
714 if (info.LID != 0) {
715 serverAH = new TAddressHandle(Port, info.LID, CONNECT_SL);
716 } else {
717 //ibv_gid addr;
718 //addr.global.subnet_prefix = info.Subnet;
719 //addr.global.interface_id = info.Interface;
720 //serverAH = new TAddressHandle(Port, addr, CONNECT_SL);
721
722 TUdpAddress local = myAddr;
723 local.Port = 0;
724 TUdpAddress remote = peerAddr;
725 remote.Port = 0;
726 //printf("local Addr %s\n", GetAddressAsString(local).c_str());
727 //printf("remote Addr %s\n", GetAddressAsString(remote).c_str());
728 // CRAP - somehow prevent connecting machines from different RoCE isles
729 serverAH = new TAddressHandle(Port, remote, local, CONNECT_SL);
730 if (!serverAH->IsValid()) {
731 return nullptr;
732 }
733 }
734 BP.PostSend(WelcomeQP, serverAH, info.QPN, WELCOME_QKEY, &handshake, sizeof(handshake));
735 //printf("send handshake\n");
736
737 return peer.Get();
738 }
739 const TIBConnectInfo& GetConnectInfo() override {
740 return ConnectInfo;
741 }

Callers 1

RecvCycleMethod · 0.45

Calls 9

GetMethod · 0.45
GetCtxMethod · 0.45
GetSRQMethod · 0.45
GetQPNMethod · 0.45
findMethod · 0.45
endMethod · 0.45
GetPSNMethod · 0.45
IsValidMethod · 0.45
PostSendMethod · 0.45

Tested by

no test coverage detected