Skip to content

Commit

Permalink
GRPC: Server code to truncate the results.
Browse files Browse the repository at this point in the history
Also protoc changes to move the executable to the tmpServer location from where the server would be launch.
  • Loading branch information
Vaibhav-Vyas committed Dec 21, 2015
1 parent fda2da9 commit 9ea6e5c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion examples/cpp/helloworld/greeter_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ extern uint64_t nanos_since_midnight();
extern void print_all_profile_stats();
// extern int add_func_stats(std::string funcName, uint64_t start_ns, uint64_t duration_ns);

void truncate_result_file()
{
static FILE *fp;
static char resultFileName[] = "cs739_grpc_result.csv";
fp = fopen(resultFileName, "w");
fclose(fp);
}

// Logic and data behind the server's behavior.
class GreeterServiceImpl final : public Greeter::Service {
Status SayHello(ServerContext* context, const HelloRequest* request,
Expand Down Expand Up @@ -168,7 +176,8 @@ void RunServer() {
}

int main(int argc, char** argv) {


truncate_result_file();
RunServer();

return 0;
Expand Down
3 changes: 3 additions & 0 deletions examples/cpp/helloworld/make_with_proto_cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
make
protoc -I ../../protos --cpp_out=. ../../protos/helloworld.proto
protoc -I ../../protos --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ../../protos/helloworld.proto
mkdir ../tmpServer
rm -rf ../tmpServer/*
cp ./* ../tmpServer/

0 comments on commit 9ea6e5c

Please sign in to comment.