Skip to content
Snippets Groups Projects
Commit 64f65458 authored by Craig Tiller's avatar Craig Tiller
Browse files

Allow secure connections with fling server

parent cf1d6eb4
Branches
Tags
No related merge requests found
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
*/ */
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
...@@ -47,6 +48,7 @@ ...@@ -47,6 +48,7 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
#include "test/core/util/port.h" #include "test/core/util/port.h"
#include "test/core/end2end/data/ssl_test_data.h"
static grpc_completion_queue *cq; static grpc_completion_queue *cq;
static grpc_server *server; static grpc_server *server;
...@@ -98,8 +100,14 @@ int main(int argc, char **argv) { ...@@ -98,8 +100,14 @@ int main(int argc, char **argv) {
gpr_log(GPR_INFO, "creating server on: %s", addr); gpr_log(GPR_INFO, "creating server on: %s", addr);
cq = grpc_completion_queue_create(); cq = grpc_completion_queue_create();
server = grpc_server_create(cq, NULL); if (secure) {
GPR_ASSERT(grpc_server_add_http2_port(server, addr)); grpc_server_credentials *ssl_creds = grpc_ssl_server_credentials_create(NULL, 0, test_server1_key, test_server1_key_size, test_server1_cert, test_server1_cert_size);
server = grpc_secure_server_create(ssl_creds, cq, NULL);
GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr));
} else {
server = grpc_server_create(cq, NULL);
GPR_ASSERT(grpc_server_add_http2_port(server, addr));
}
grpc_server_start(server); grpc_server_start(server);
gpr_free(addr_buf); gpr_free(addr_buf);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment