Makes GeneratePrivateData() public
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=229239892
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user