Makes GeneratePrivateData() public
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=229239892
This commit is contained in:
@@ -17,7 +17,7 @@ git_repository(
|
|||||||
git_repository(
|
git_repository(
|
||||||
name = "protobuf_repo",
|
name = "protobuf_repo",
|
||||||
remote = "https://github.com/google/protobuf.git",
|
remote = "https://github.com/google/protobuf.git",
|
||||||
tag = "v3.5.0",
|
tag = "v3.6.1.3",
|
||||||
)
|
)
|
||||||
|
|
||||||
git_repository(
|
git_repository(
|
||||||
@@ -28,7 +28,7 @@ git_repository(
|
|||||||
|
|
||||||
git_repository(
|
git_repository(
|
||||||
name = "gflags_repo",
|
name = "gflags_repo",
|
||||||
commit = "fe57e5af4db74ab298523f06d2c43aa895ba9f98", # 2016-07-20
|
commit = "e171aa2d15ed9eb17054558e0b3a6a413bb01067", # 2018-11-11
|
||||||
remote = "https://github.com/gflags/gflags.git",
|
remote = "https://github.com/gflags/gflags.git",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -63,8 +63,7 @@ class WvCasCaDescriptor {
|
|||||||
// where the descriptor will be added.
|
// where the descriptor will be added.
|
||||||
virtual size_t CaDescriptorBaseSize() const;
|
virtual size_t CaDescriptorBaseSize() const;
|
||||||
|
|
||||||
protected:
|
// Return private data in the CA descriptor.
|
||||||
// Protected visibility to support unit testing.
|
|
||||||
virtual std::string GeneratePrivateData(const std::string& provider,
|
virtual std::string GeneratePrivateData(const std::string& provider,
|
||||||
const std::string& content_id) const;
|
const std::string& content_id) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -164,7 +164,6 @@ class FakePrivateDataCaDescriptor : public WvCasCaDescriptor {
|
|||||||
public:
|
public:
|
||||||
void set_private_data(std::string private_data) { private_data_ = private_data; }
|
void set_private_data(std::string private_data) { private_data_ = private_data; }
|
||||||
|
|
||||||
protected:
|
|
||||||
std::string GeneratePrivateData(const std::string& provider,
|
std::string GeneratePrivateData(const std::string& provider,
|
||||||
const std::string& content_id) const override {
|
const std::string& content_id) const override {
|
||||||
return private_data_;
|
return private_data_;
|
||||||
|
|||||||
@@ -159,9 +159,6 @@ int main(int argc, char** argv) {
|
|||||||
break;
|
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 loop to serve different client connections.
|
||||||
while (true) {
|
while (true) {
|
||||||
struct sockaddr_in client_address;
|
struct sockaddr_in client_address;
|
||||||
@@ -169,17 +166,25 @@ int main(int argc, char** argv) {
|
|||||||
int client_socket_fd = accept(
|
int client_socket_fd = accept(
|
||||||
listen_socket_fd, reinterpret_cast<struct sockaddr*>(&client_address),
|
listen_socket_fd, reinterpret_cast<struct sockaddr*>(&client_address),
|
||||||
&client_address_size);
|
&client_address_size);
|
||||||
LOG(INFO) << "\nTCP connection start\n";
|
LOG(INFO) << "\nTCP connection " << client_socket_fd << " start\n";
|
||||||
if (client_socket_fd < 0) {
|
if (client_socket_fd < 0) {
|
||||||
LOG(ERROR) << "Failed to accept connection request from client";
|
LOG(ERROR) << "Failed to accept connection request from client";
|
||||||
} else {
|
} else {
|
||||||
// TODO(user): Support multi-threading of serving concurrent clients.
|
// TODO(user): Consider limit the number of forked child processes.
|
||||||
// TODO(user): Per jfore@ suggestion, look into using
|
// I.e., limiting number of concurrent clients.
|
||||||
// http://man7.org/linux/man-pages/man7/epoll.7.html
|
if (fork() == 0) {
|
||||||
ServeClient(client_socket_fd, &client_handler);
|
// 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);
|
usleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user