Makes GeneratePrivateData() public

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=229239892
This commit is contained in:
Fang Yu
2019-01-14 13:12:28 -08:00
parent e35ce1c32e
commit 4f5c02fb39
4 changed files with 18 additions and 15 deletions

View File

@@ -17,7 +17,7 @@ git_repository(
git_repository(
name = "protobuf_repo",
remote = "https://github.com/google/protobuf.git",
tag = "v3.5.0",
tag = "v3.6.1.3",
)
git_repository(
@@ -28,7 +28,7 @@ git_repository(
git_repository(
name = "gflags_repo",
commit = "fe57e5af4db74ab298523f06d2c43aa895ba9f98", # 2016-07-20
commit = "e171aa2d15ed9eb17054558e0b3a6a413bb01067", # 2018-11-11
remote = "https://github.com/gflags/gflags.git",
)

View File

@@ -63,8 +63,7 @@ class WvCasCaDescriptor {
// where the descriptor will be added.
virtual size_t CaDescriptorBaseSize() const;
protected:
// Protected visibility to support unit testing.
// Return private data in the CA descriptor.
virtual std::string GeneratePrivateData(const std::string& provider,
const std::string& content_id) const;
};

View File

@@ -164,7 +164,6 @@ class FakePrivateDataCaDescriptor : public WvCasCaDescriptor {
public:
void set_private_data(std::string private_data) { private_data_ = private_data; }
protected:
std::string GeneratePrivateData(const std::string& provider,
const std::string& content_id) const override {
return private_data_;

View File

@@ -159,9 +159,6 @@ int main(int argc, char** argv) {
break;
}
// A single client handler, allow only 1 TCP connection / 1 channel at a time.
EcmgClientHandler client_handler(&ecmg_config);
// While loop to serve different client connections.
while (true) {
struct sockaddr_in client_address;
@@ -169,17 +166,25 @@ int main(int argc, char** argv) {
int client_socket_fd = accept(
listen_socket_fd, reinterpret_cast<struct sockaddr*>(&client_address),
&client_address_size);
LOG(INFO) << "\nTCP connection start\n";
LOG(INFO) << "\nTCP connection " << client_socket_fd << " start\n";
if (client_socket_fd < 0) {
LOG(ERROR) << "Failed to accept connection request from client";
} else {
// TODO(user): Support multi-threading of serving concurrent clients.
// TODO(user): Per jfore@ suggestion, look into using
// http://man7.org/linux/man-pages/man7/epoll.7.html
ServeClient(client_socket_fd, &client_handler);
// TODO(user): Consider limit the number of forked child processes.
// I.e., limiting number of concurrent clients.
if (fork() == 0) {
// Reaching here, I am in the child process.
close(listen_socket_fd);
EcmgClientHandler client_handler(&ecmg_config);
ServeClient(client_socket_fd, &client_handler);
LOG(INFO) << "\nTCP connection " << client_socket_fd << " closed\n";
close(client_socket_fd);
// Terminate child process.
exit(0);
}
// Reaching here, I am in parent process.
close(client_socket_fd);
}
LOG(INFO) << "\nTCP connection closed\n";
close(client_socket_fd);
usleep(1000);
}