summaryrefslogtreecommitdiff
path: root/test/c_glib
diff options
context:
space:
mode:
authorzeshuai007 <51382517@qq.com>2020-11-30 11:16:10 +0800
committerJens Geyer <jensg@apache.org>2021-04-01 23:34:47 +0200
commit037753eb6b5c56db0c2b9f4d932377f06452022b (patch)
tree6e8e1cd5656a149bebd59d349864d21dc65c59c9 /test/c_glib
parentfa87d0ea424da50930c2843e1117a5c2abe20593 (diff)
downloadthrift-037753eb6b5c56db0c2b9f4d932377f06452022b.tar.gz
THRIFT-5265 add the zlib transport to c_glib
Client: c_glib Patch: Zezeng Wang This closes #2216
Diffstat (limited to 'test/c_glib')
-rw-r--r--test/c_glib/CMakeLists.txt6
-rw-r--r--test/c_glib/src/test_server.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/test/c_glib/CMakeLists.txt b/test/c_glib/CMakeLists.txt
index 7a7daadc5..2e2d6870e 100644
--- a/test/c_glib/CMakeLists.txt
+++ b/test/c_glib/CMakeLists.txt
@@ -41,8 +41,12 @@ set(crosstestgencglib_SOURCES
add_library(crosstestgencglib STATIC ${crosstestgencglib_SOURCES})
LINK_AGAINST_THRIFT_LIBRARY(crosstestgencglib thrift_c_glib)
+if (WITH_ZLIB)
+ LINK_AGAINST_THRIFT_LIBRARY(crosstestgencglib thrift_c_glib_zlib)
+endif ()
+
add_executable(test_server src/test_server.c src/thrift_test_handler.c src/thrift_second_service_handler.c)
-target_link_libraries(test_server crosstestgencglib)
+target_link_libraries(test_server crosstestgencglib ${ZLIB_LIBRARIES})
add_executable(test_client src/test_client.c)
target_link_libraries(test_client crosstestgencglib "${OPENSSL_LIBRARIES}")
diff --git a/test/c_glib/src/test_server.c b/test/c_glib/src/test_server.c
index c949530de..c57e1cfb9 100644
--- a/test/c_glib/src/test_server.c
+++ b/test/c_glib/src/test_server.c
@@ -32,6 +32,8 @@
#include <thrift/c_glib/transport/thrift_buffered_transport_factory.h>
#include <thrift/c_glib/transport/thrift_framed_transport.h>
#include <thrift/c_glib/transport/thrift_framed_transport_factory.h>
+#include <thrift/c_glib/transport/thrift_zlib_transport.h>
+#include <thrift/c_glib/transport/thrift_zlib_transport_factory.h>
#include <thrift/c_glib/transport/thrift_server_socket.h>
#include <thrift/c_glib/transport/thrift_server_transport.h>
#include <thrift/c_glib/transport/thrift_transport.h>
@@ -85,7 +87,7 @@ main (int argc, char **argv)
{ "server-type", 0, 0, G_OPTION_ARG_STRING, &server_type_option,
"Type of server: simple (=simple)", NULL },
{ "transport", 0, 0, G_OPTION_ARG_STRING, &transport_option,
- "Transport: buffered, framed (=buffered)", NULL },
+ "Transport: buffered, framed, zlib (=buffered)", NULL },
{ "protocol", 0, 0, G_OPTION_ARG_STRING, &protocol_option,
"Protocol: binary, compact (=binary)", NULL },
{ "string-limit", 0, 0, G_OPTION_ARG_INT, &string_limit,
@@ -167,6 +169,10 @@ main (int argc, char **argv)
transport_factory_type = THRIFT_TYPE_FRAMED_TRANSPORT_FACTORY;
transport_name = "framed";
}
+ else if (strncmp (transport_option, "zlib", 5) == 0) {
+ transport_factory_type = THRIFT_TYPE_ZLIB_TRANSPORT_FACTORY;
+ transport_name = "zlib";
+ }
else if (strncmp (transport_option, "buffered", 9) != 0) {
fprintf (stderr, "Unknown transport type %s\n", transport_option);
options_valid = FALSE;