Skip to content

Commit

Permalink
Merge pull request grpc#105 from ctiller/sec
Browse files Browse the repository at this point in the history
Allow secure connections with fling server
  • Loading branch information
yang-g committed Jan 20, 2015
2 parents dd2a35d + bcfa267 commit a16c34d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/core/fling/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
*/

#include <grpc/grpc.h>
#include <grpc/grpc_security.h>

#include <signal.h>
#include <stdio.h>
Expand All @@ -47,6 +48,7 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "test/core/util/port.h"
#include "test/core/end2end/data/ssl_test_data.h"

static grpc_completion_queue *cq;
static grpc_server *server;
Expand Down Expand Up @@ -98,8 +100,17 @@ int main(int argc, char **argv) {
gpr_log(GPR_INFO, "creating server on: %s", addr);

cq = grpc_completion_queue_create();
server = grpc_server_create(cq, NULL);
GPR_ASSERT(grpc_server_add_http2_port(server, addr));
if (secure) {
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));
grpc_server_credentials_release(ssl_creds);
} else {
server = grpc_server_create(cq, NULL);
GPR_ASSERT(grpc_server_add_http2_port(server, addr));
}
grpc_server_start(server);

gpr_free(addr_buf);
Expand Down

0 comments on commit a16c34d

Please sign in to comment.