MCPcopy Create free account
hub / github.com/apple/foundationdb / connect

Method connect

flow/Net2.actor.cpp:607–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605
606public:
607 ACTOR static Future<Reference<IUDPSocket>> connect(boost::asio::io_service* io_service,
608 Optional<NetworkAddress> toAddress,
609 bool isV6) {
610 state Reference<UDPSocket> self(new UDPSocket(*io_service, toAddress, isV6));
611 ASSERT(!toAddress.present() || toAddress.get().ip.isV6() == isV6);
612 if (!toAddress.present()) {
613 return self;
614 }
615 try {
616 if (toAddress.present()) {
617 auto to = udpEndpoint(toAddress.get());
618 BindPromise p("N2_UDPConnectError", self->id);
619 Future<Void> onConnected = p.getFuture();
620 self->socket.async_connect(to, std::move(p));
621
622 wait(onConnected);
623 }
624 self->init();
625 return self;
626 } catch (...) {
627 self->closeSocket();
628 throw;
629 }
630 }
631
632 void close() override { closeSocket(); }
633

Callers

nothing calls this directly

Calls 8

initMethod · 0.95
closeSocketMethod · 0.95
udpEndpointFunction · 0.85
moveFunction · 0.85
getMethod · 0.65
presentMethod · 0.45
isV6Method · 0.45
getFutureMethod · 0.45

Tested by

no test coverage detected