MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / connect

Method connect

src/ipc/process.cpp:100–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100int ProcessImpl::connect(const fs::path& data_dir,
101 const std::string& dest_exe_name,
102 std::string& address)
103{
104 struct sockaddr_un addr;
105 std::string error;
106 if (!ParseAddress(address, data_dir, dest_exe_name, addr, error)) {
107 throw std::invalid_argument(error);
108 }
109
110 int fd;
111 if ((fd = ::socket(addr.sun_family, SOCK_STREAM, 0)) == -1) {
112 throw std::system_error(errno, std::system_category());
113 }
114 if (::connect(fd, (struct sockaddr*)&addr, sizeof(addr)) == 0) {
115 return fd;
116 }
117 int connect_error = errno;
118 if (::close(fd) != 0) {
119 LogWarning("Error closing file descriptor %i '%s': %s", fd, address, SysErrorString(errno));
120 }
121 throw std::system_error(connect_error, std::system_category());
122}
123
124int ProcessImpl::bind(const fs::path& data_dir, const std::string& exe_name, std::string& address)
125{

Callers 15

__init__Method · 0.45
mainFunction · 0.45
call_with_authFunction · 0.45
rpccallFunction · 0.45
reset_connMethod · 0.45
run_testMethod · 0.45
run_testMethod · 0.45
setup_zmq_testMethod · 0.45
test_ipv6_localFunction · 0.45
stopMethod · 0.45
inspect_sqlite_dbMethod · 0.45

Calls 2

ParseAddressFunction · 0.85
SysErrorStringFunction · 0.85

Tested by 4

test_ipv6_localFunction · 0.36
inspect_sqlite_dbMethod · 0.36
BOOST_AUTO_TEST_CASEFunction · 0.36
SendCoinsFunction · 0.36