Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differential Revision: D38792698 #346

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions fbpcf/engine/communication/SocketPartyCommunicationAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ SocketPartyCommunicationAgent::SocketPartyCommunicationAgent(
std::string tlsDir,
std::shared_ptr<PartyCommunicationAgentTrafficRecorder> recorder)
: recorder_(recorder), ssl_(nullptr) {
XLOG(INFO) << "In old constructor as server";
if (useTls) {
openServerPortWithTls(sockFd, portNo, tlsDir);
} else {
Expand All @@ -72,6 +73,7 @@ SocketPartyCommunicationAgent::SocketPartyCommunicationAgent(
TlsInfo tlsInfo,
std::shared_ptr<PartyCommunicationAgentTrafficRecorder> recorder)
: recorder_(recorder), ssl_(nullptr), tlsInfo_(tlsInfo) {
XLOG(INFO) << "In new constructor as server";
if (tlsInfo.useTls) {
openServerPortWithTls(sockFd, portNo, tlsInfo);
} else {
Expand All @@ -86,6 +88,7 @@ SocketPartyCommunicationAgent::SocketPartyCommunicationAgent(
std::string tlsDir,
std::shared_ptr<PartyCommunicationAgentTrafficRecorder> recorder)
: recorder_(recorder), ssl_(nullptr) {
XLOG(INFO) << "In old constructor as client";
if (useTls) {
openClientPortWithTls(serverAddress, portNo, tlsDir);
} else {
Expand All @@ -99,6 +102,7 @@ SocketPartyCommunicationAgent::SocketPartyCommunicationAgent(
TlsInfo tlsInfo,
std::shared_ptr<PartyCommunicationAgentTrafficRecorder> recorder)
: recorder_(recorder), ssl_(nullptr), tlsInfo_(tlsInfo) {
XLOG(INFO) << "In new constructor as client";
if (tlsInfo.useTls) {
openClientPortWithTls(serverAddress, portNo, tlsInfo);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace fbpcf::engine::communication {

std::unique_ptr<IPartyCommunicationAgent>
SocketPartyCommunicationAgentFactory::create(int id, std::string name) {
XLOGF(INFO, "Create called with {}", tlsInfo_.useTls);
if (id == myId_) {
throw std::runtime_error("No need to talk to myself!");
} else {
Expand All @@ -33,11 +34,11 @@ SocketPartyCommunicationAgentFactory::create(int id, std::string name) {
auto [socket, portNo] = createSocketFromMaybeFreePort(assignedPortNo);
iter->second.second->sendSingleT<int>(portNo);
return std::make_unique<SocketPartyCommunicationAgent>(
socket, portNo, useTls_, tlsDir_, recorder);
socket, portNo, tlsInfo_, recorder);
} else {
auto portNo = iter->second.second->receiveSingleT<int>();
return std::make_unique<SocketPartyCommunicationAgent>(
iter->second.first.address, portNo, useTls_, tlsDir_, recorder);
iter->second.first.address, portNo, tlsInfo_, recorder);
}
}
}
Expand Down Expand Up @@ -112,7 +113,7 @@ void SocketPartyCommunicationAgentFactory::setupInitialConnection(
std::make_pair(
item.second,
std::make_unique<SocketPartyCommunicationAgent>(
socket, item.second.portNo, useTls_, tlsDir_, recorder))});
socket, item.second.portNo, tlsInfo_, recorder))});

} else if (myId_ > item.first) {
auto recorder =
Expand All @@ -127,8 +128,7 @@ void SocketPartyCommunicationAgentFactory::setupInitialConnection(
std::make_unique<SocketPartyCommunicationAgent>(
item.second.address,
item.second.portNo,
useTls_,
tlsDir_,
tlsInfo_,
recorder))});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ establishing multiple connections (>3) between each party pair.
tlsInfo.keyPath = "";
tlsInfo.passphrasePath = "";
tlsInfo_ = tlsInfo;
XLOGF(INFO, "factory initialized with {}", tlsInfo_.useTls);
}

SocketPartyCommunicationAgentFactory(
Expand All @@ -79,6 +80,7 @@ establishing multiple connections (>3) between each party pair.
tlsInfo.keyPath = tlsDir + "/key.pem";
tlsInfo.passphrasePath = tlsDir + "/passphrase.pem";
tlsInfo_ = tlsInfo;
XLOGF(INFO, "factory initialized with {}", tlsInfo_.useTls);
}

SocketPartyCommunicationAgentFactory(
Expand Down