Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
8fa80df3
Commit
8fa80df3
authored
May 22, 2018
by
wangxuefeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/brpc/brpc
into kenshinxf
parents
b75dbd03
58e67e46
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
201 additions
and
79 deletions
+201
-79
CMakeLists.txt
CMakeLists.txt
+2
-2
config_brpc.sh
config_brpc.sh
+7
-2
getting_started.md
docs/cn/getting_started.md
+1
-1
CMakeLists.txt
example/asynchronous_echo_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/backup_request_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/cancel_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/cascade_echo_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/dynamic_partition_echo_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/echo_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/echo_c++_hulu_pbrpc/CMakeLists.txt
+3
-2
CMakeLists.txt
example/echo_c++_sofa_pbrpc/CMakeLists.txt
+3
-2
CMakeLists.txt
example/echo_c++_ubrpc_compack/CMakeLists.txt
+3
-2
CMakeLists.txt
example/http_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/memcache_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/multi_threaded_echo_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/multi_threaded_echo_fns_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/multi_threaded_mcpack_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/nshead_extension_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/nshead_pb_extension_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/parallel_echo_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/partition_echo_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/redis_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/selective_echo_c++/CMakeLists.txt
+3
-2
CMakeLists.txt
example/session_data_and_thread_local/CMakeLists.txt
+3
-2
CMakeLists.txt
example/streaming_echo_c++/CMakeLists.txt
+3
-2
thrift_utils.h
src/brpc/details/thrift_utils.h
+1
-0
global.cpp
src/brpc/global.cpp
+3
-4
rtmp_protocol.cpp
src/brpc/policy/rtmp_protocol.cpp
+19
-0
rtmp_protocol.h
src/brpc/policy/rtmp_protocol.h
+1
-0
rtmp.cpp
src/brpc/rtmp.cpp
+72
-13
rtmp.h
src/brpc/rtmp.h
+21
-5
hash_tables.h
src/butil/containers/hash_tables.h
+1
-1
brpc_streaming_rpc_unittest.cpp
test/brpc_streaming_rpc_unittest.cpp
+7
-7
No files found.
CMakeLists.txt
View file @
8fa80df3
...
@@ -158,7 +158,6 @@ set(DYNAMIC_LIB
...
@@ -158,7 +158,6 @@ set(DYNAMIC_LIB
${
PROTOC_LIB
}
${
PROTOC_LIB
}
${
CMAKE_THREAD_LIBS_INIT
}
${
CMAKE_THREAD_LIBS_INIT
}
${
THRIFT_LIB
}
${
THRIFT_LIB
}
rt
${
SSL_LIB
}
${
SSL_LIB
}
${
CRYPTO_LIB
}
${
CRYPTO_LIB
}
dl
dl
...
@@ -183,7 +182,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -183,7 +182,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
# for *.so
# for *.so
...
...
config_brpc.sh
View file @
8fa80df3
SYSTEM
=
$(
uname
-s
)
SYSTEM
=
$(
uname
-s
)
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
ECHO
=
'echo -e'
if
[
-z
"
$BASH
"
]
||
[
"
$BASH
"
=
"/bin/sh"
]
;
then
ECHO
=
echo
else
ECHO
=
'echo -e'
fi
SO
=
dylib
SO
=
dylib
LDD
=
"otool -L"
LDD
=
"otool -L"
if
[
"
$(
getopt
-V
)
"
=
" --"
]
;
then
if
[
"
$(
getopt
-V
)
"
=
" --"
]
;
then
...
@@ -142,6 +146,7 @@ if [ "$SYSTEM" = "Darwin" ]; then
...
@@ -142,6 +146,7 @@ if [ "$SYSTEM" = "Darwin" ]; then
DYNAMIC_LINKINGS
=
"
$DYNAMIC_LINKINGS
-Wl,-U,_MallocExtension_ReleaseFreeMemory"
DYNAMIC_LINKINGS
=
"
$DYNAMIC_LINKINGS
-Wl,-U,_MallocExtension_ReleaseFreeMemory"
DYNAMIC_LINKINGS
=
"
$DYNAMIC_LINKINGS
-Wl,-U,_ProfilerStart"
DYNAMIC_LINKINGS
=
"
$DYNAMIC_LINKINGS
-Wl,-U,_ProfilerStart"
DYNAMIC_LINKINGS
=
"
$DYNAMIC_LINKINGS
-Wl,-U,_ProfilerStop"
DYNAMIC_LINKINGS
=
"
$DYNAMIC_LINKINGS
-Wl,-U,_ProfilerStop"
DYNAMIC_LINKINGS
=
"
$DYNAMIC_LINKINGS
-Wl,-U,_RegisterThriftProtocol"
fi
fi
append_linking
()
{
append_linking
()
{
if
[
-f
$1
/lib
${
2
}
.a
]
;
then
if
[
-f
$1
/lib
${
2
}
.a
]
;
then
...
@@ -272,7 +277,7 @@ if [ ! -z "$DEBUGSYMBOLS" ]; then
...
@@ -272,7 +277,7 @@ if [ ! -z "$DEBUGSYMBOLS" ]; then
fi
fi
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
CPPFLAGS
=
"
${
CPPFLAGS
}
-Wno-deprecated-declarations"
CPPFLAGS
=
"
${
CPPFLAGS
}
-Wno-deprecated-declarations"
version
=
`
s
ystem_profiler SPSoftwareDataType |
grep
"System Version"
|
awk
'{print $5}'
|
awk
-F
.
'{printf "%d.%d", $1,
$2}'
`
version
=
`
s
w_vers
-productVersion
|
awk
-F
'.'
'{print $1 "."
$2}'
`
if
[[
`
echo
"
$version
<10.12"
| bc
-l
`
==
1
]]
;
then
if
[[
`
echo
"
$version
<10.12"
| bc
-l
`
==
1
]]
;
then
CPPFLAGS
=
"
${
CPPFLAGS
}
-DNO_CLOCK_GETTIME_IN_MAC"
CPPFLAGS
=
"
${
CPPFLAGS
}
-DNO_CLOCK_GETTIME_IN_MAC"
fi
fi
...
...
docs/cn/getting_started.md
View file @
8fa80df3
...
@@ -222,7 +222,7 @@ To not link debugging symbols, use `cmake -DWITH_DEBUG_SYMBOLS=OFF ..` and compi
...
@@ -222,7 +222,7 @@ To not link debugging symbols, use `cmake -DWITH_DEBUG_SYMBOLS=OFF ..` and compi
Install common deps:
Install common deps:
```
```
$ brew install openssl git
$ brew install openssl git
gnu-getopt
```
```
Install
[
gflags
](
https://github.com/gflags/gflags
)
,
[
protobuf
](
https://github.com/google/protobuf
)
,
[
leveldb
](
https://github.com/google/leveldb
)
:
Install
[
gflags
](
https://github.com/gflags/gflags
)
,
[
protobuf
](
https://github.com/google/protobuf
)
,
[
leveldb
](
https://github.com/google/leveldb
)
:
...
...
example/asynchronous_echo_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(asynchronous_echo_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(asynchronous_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
asynchronous_echo_client client.cpp
${
PROTO_SRC
}
)
add_executable
(
asynchronous_echo_client client.cpp
${
PROTO_SRC
}
)
...
...
example/backup_request_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(backup_request_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(backup_request_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
backup_request_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
backup_request_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/cancel_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(cancel_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(cancel_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
cancel_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
cancel_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/cascade_echo_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(cascade_echo_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(cascade_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -104,7 +104,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -104,7 +104,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
cascade_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
cascade_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/dynamic_partition_echo_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(dynamic_partition_echo_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(dynamic_partition_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
dynamic_partition_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
dynamic_partition_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/echo_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(echo_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -108,7 +108,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -108,7 +108,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
target_link_libraries
(
echo_client
${
BRPC_LIB
}
${
DYNAMIC_LIB
}
)
target_link_libraries
(
echo_client
${
BRPC_LIB
}
${
DYNAMIC_LIB
}
)
...
...
example/echo_c++_hulu_pbrpc/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(echo_c++_hulu_pbrpc C CXX)
...
@@ -4,7 +4,7 @@ project(echo_c++_hulu_pbrpc C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
echo_hulu_pbrpc_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
echo_hulu_pbrpc_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/echo_c++_sofa_pbrpc/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(echo_c++_sofa_pbrpc C CXX)
...
@@ -4,7 +4,7 @@ project(echo_c++_sofa_pbrpc C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
echo_sofa_pbrpc_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
echo_sofa_pbrpc_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/echo_c++_ubrpc_compack/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(echo_c++_ubrpc_compack C CXX)
...
@@ -4,7 +4,7 @@ project(echo_c++_ubrpc_compack C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
execute_process
(
execute_process
(
...
...
example/http_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(http_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(http_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -111,7 +111,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -111,7 +111,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
http_client http_client.cpp
)
add_executable
(
http_client http_client.cpp
)
...
...
example/memcache_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(memcache_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(memcache_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
memcache_client client.cpp
)
add_executable
(
memcache_client client.cpp
)
...
...
example/multi_threaded_echo_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(multi_threaded_echo_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(multi_threaded_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
multi_threaded_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
multi_threaded_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/multi_threaded_echo_fns_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(multi_threaded_echo_fns_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(multi_threaded_echo_fns_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
multi_threaded_echo_fns_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
multi_threaded_echo_fns_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/multi_threaded_mcpack_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(multi_threaded_mcpack_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(multi_threaded_mcpack_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
execute_process
(
execute_process
(
...
...
example/nshead_extension_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(nshead_extension_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(nshead_extension_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
nshead_extension_client client.cpp
)
add_executable
(
nshead_extension_client client.cpp
)
...
...
example/nshead_pb_extension_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(nshead_pb_extension_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(nshead_pb_extension_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
nshead_pb_extension_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
nshead_pb_extension_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/parallel_echo_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(parallel_echo_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(parallel_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
parallel_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
parallel_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/partition_echo_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(partition_echo_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(partition_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/redis_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -12,7 +12,7 @@ project(redis_c++ C CXX)
...
@@ -12,7 +12,7 @@ project(redis_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
redis_cli redis_cli.cpp
)
add_executable
(
redis_cli redis_cli.cpp
)
...
...
example/selective_echo_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(selective_echo_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(selective_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -110,7 +110,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
selective_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
selective_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/session_data_and_thread_local/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(session_data_and_thread_local C CXX)
...
@@ -4,7 +4,7 @@ project(session_data_and_thread_local C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -117,7 +117,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -117,7 +117,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
session_data_and_thread_local_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
session_data_and_thread_local_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
example/streaming_echo_c++/CMakeLists.txt
View file @
8fa80df3
...
@@ -4,7 +4,7 @@ project(streaming_echo_c++ C CXX)
...
@@ -4,7 +4,7 @@ project(streaming_echo_c++ C CXX)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
execute_process
(
execute_process
(
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
| xargs dirname | tr -d '
\n
'"
COMMAND bash -c
"find
${
CMAKE_SOURCE_DIR
}
/../.. -type d -regex
\"
.*output/include$
\"
|
head -n1 |
xargs dirname | tr -d '
\n
'"
OUTPUT_VARIABLE OUTPUT_PATH
OUTPUT_VARIABLE OUTPUT_PATH
)
)
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
...
@@ -105,7 +105,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
"-framework Foundation"
"-framework Foundation"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_MallocExtension_ReleaseFreeMemory"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStart"
"-Wl,-U,_ProfilerStop"
)
"-Wl,-U,_ProfilerStop"
"-Wl,-U,_RegisterThriftProtocol"
)
endif
()
endif
()
add_executable
(
streaming_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
streaming_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
...
...
src/brpc/details/thrift_utils.h
View file @
8fa80df3
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#if defined(_THRIFT_STDCXX_H_)
#if defined(_THRIFT_STDCXX_H_)
# define THRIFT_STDCXX apache::thrift::stdcxx
# define THRIFT_STDCXX apache::thrift::stdcxx
#else
#else
# include <boost/make_shared.hpp>
# define THRIFT_STDCXX boost
# define THRIFT_STDCXX boost
#include <boost/make_shared.hpp>
#include <boost/make_shared.hpp>
#endif
#endif
...
...
src/brpc/global.cpp
View file @
8fa80df3
...
@@ -77,6 +77,7 @@
...
@@ -77,6 +77,7 @@
extern
"C"
{
extern
"C"
{
// defined in gperftools/malloc_extension_c.h
// defined in gperftools/malloc_extension_c.h
void
BAIDU_WEAK
MallocExtension_ReleaseFreeMemory
(
void
);
void
BAIDU_WEAK
MallocExtension_ReleaseFreeMemory
(
void
);
void
BAIDU_WEAK
RegisterThriftProtocol
();
}
}
namespace
brpc
{
namespace
brpc
{
...
@@ -97,7 +98,6 @@ using namespace policy;
...
@@ -97,7 +98,6 @@ using namespace policy;
const
char
*
const
DUMMY_SERVER_PORT_FILE
=
"dummy_server.port"
;
const
char
*
const
DUMMY_SERVER_PORT_FILE
=
"dummy_server.port"
;
void
__attribute__
((
weak
))
RegisterThriftProtocol
();
struct
GlobalExtensions
{
struct
GlobalExtensions
{
GlobalExtensions
()
GlobalExtensions
()
...
@@ -467,9 +467,8 @@ static void GlobalInitializeOrDieImpl() {
...
@@ -467,9 +467,8 @@ static void GlobalInitializeOrDieImpl() {
}
}
// Register Thrift framed protocol if linked
// Register Thrift framed protocol if linked
if
(
RegisterThriftProtocol
)
{
if
(
brpc
::
RegisterThriftProtocol
)
{
RegisterThriftProtocol
();
brpc
::
RegisterThriftProtocol
();
}
}
// Only valid at client side
// Only valid at client side
...
...
src/brpc/policy/rtmp_protocol.cpp
View file @
8fa80df3
...
@@ -2227,6 +2227,25 @@ bool RtmpChunkStream::OnDataMessageAMF0(
...
@@ -2227,6 +2227,25 @@ bool RtmpChunkStream::OnDataMessageAMF0(
}
}
stream
->
CallOnMetaData
(
&
metadata
,
name
);
stream
->
CallOnMetaData
(
&
metadata
,
name
);
return
true
;
return
true
;
}
else
if
(
name
==
RTMP_AMF0_ON_CUE_POINT
)
{
if
(
istream
.
check_emptiness
())
{
return
false
;
}
RtmpCuePoint
cuepoint
;
cuepoint
.
timestamp
=
mh
.
timestamp
;
if
(
!
ReadAMFObject
(
&
cuepoint
.
data
,
&
istream
))
{
RTMP_ERROR
(
socket
,
mh
)
<<
"Fail to read cuepoint"
;
return
false
;
}
// TODO: execq?
butil
::
intrusive_ptr
<
RtmpStreamBase
>
stream
;
if
(
!
connection_context
()
->
FindMessageStream
(
mh
.
stream_id
,
&
stream
))
{
LOG_EVERY_SECOND
(
WARNING
)
<<
socket
->
remote_side
()
<<
": Fail to find stream_id="
<<
mh
.
stream_id
;
return
false
;
}
stream
->
CallOnCuePoint
(
&
cuepoint
);
return
true
;
}
else
if
(
name
==
RTMP_AMF0_DATA_SAMPLE_ACCESS
)
{
}
else
if
(
name
==
RTMP_AMF0_DATA_SAMPLE_ACCESS
)
{
return
true
;
return
true
;
}
else
if
(
name
==
RTMP_AMF0_COMMAND_ON_STATUS
)
{
}
else
if
(
name
==
RTMP_AMF0_COMMAND_ON_STATUS
)
{
...
...
src/brpc/policy/rtmp_protocol.h
View file @
8fa80df3
...
@@ -112,6 +112,7 @@ const char* messagetype2str(uint8_t);
...
@@ -112,6 +112,7 @@ const char* messagetype2str(uint8_t);
#define RTMP_AMF0_COMMAND_CALL "call"
#define RTMP_AMF0_COMMAND_CALL "call"
#define RTMP_AMF0_SET_DATAFRAME "@setDataFrame"
#define RTMP_AMF0_SET_DATAFRAME "@setDataFrame"
#define RTMP_AMF0_ON_META_DATA "onMetaData"
#define RTMP_AMF0_ON_META_DATA "onMetaData"
#define RTMP_AMF0_ON_CUE_POINT "onCuePoint"
#define RTMP_AMF0_SAMPLE_ACCESS "|RtmpSampleAccess"
#define RTMP_AMF0_SAMPLE_ACCESS "|RtmpSampleAccess"
#define RTMP_INFO_LEVEL_STATUS "status"
#define RTMP_INFO_LEVEL_STATUS "status"
...
...
src/brpc/rtmp.cpp
View file @
8fa80df3
...
@@ -119,17 +119,7 @@ butil::Status FlvWriter::Write(const RtmpAudioMessage& msg) {
...
@@ -119,17 +119,7 @@ butil::Status FlvWriter::Write(const RtmpAudioMessage& msg) {
return
butil
::
Status
::
OK
();
return
butil
::
Status
::
OK
();
}
}
butil
::
Status
FlvWriter
::
Write
(
const
RtmpMetaData
&
metadata
)
{
butil
::
Status
FlvWriter
::
WriteScriptData
(
const
butil
::
IOBuf
&
req_buf
,
uint32_t
timestamp
)
{
butil
::
IOBuf
req_buf
;
{
butil
::
IOBufAsZeroCopyOutputStream
zc_stream
(
&
req_buf
);
AMFOutputStream
ostream
(
&
zc_stream
);
WriteAMFString
(
RTMP_AMF0_ON_META_DATA
,
&
ostream
);
WriteAMFObject
(
metadata
.
data
,
&
ostream
);
if
(
!
ostream
.
good
())
{
return
butil
::
Status
(
EINVAL
,
"Fail to serialize metadata"
);
}
}
char
buf
[
32
];
char
buf
[
32
];
char
*
p
=
buf
;
char
*
p
=
buf
;
if
(
!
_write_header
)
{
if
(
!
_write_header
)
{
...
@@ -141,8 +131,8 @@ butil::Status FlvWriter::Write(const RtmpMetaData& metadata) {
...
@@ -141,8 +131,8 @@ butil::Status FlvWriter::Write(const RtmpMetaData& metadata) {
// FLV tag
// FLV tag
*
p
++
=
FLV_TAG_SCRIPT_DATA
;
*
p
++
=
FLV_TAG_SCRIPT_DATA
;
policy
::
WriteBigEndian3Bytes
(
&
p
,
req_buf
.
size
());
policy
::
WriteBigEndian3Bytes
(
&
p
,
req_buf
.
size
());
policy
::
WriteBigEndian3Bytes
(
&
p
,
(
metadata
.
timestamp
&
0xFFFFFF
));
policy
::
WriteBigEndian3Bytes
(
&
p
,
(
timestamp
&
0xFFFFFF
));
*
p
++
=
(
metadata
.
timestamp
>>
24
)
&
0xFF
;
*
p
++
=
(
timestamp
>>
24
)
&
0xFF
;
policy
::
WriteBigEndian3Bytes
(
&
p
,
0
);
// StreamID
policy
::
WriteBigEndian3Bytes
(
&
p
,
0
);
// StreamID
_buf
->
append
(
buf
,
p
-
buf
);
_buf
->
append
(
buf
,
p
-
buf
);
_buf
->
append
(
req_buf
);
_buf
->
append
(
req_buf
);
...
@@ -153,6 +143,35 @@ butil::Status FlvWriter::Write(const RtmpMetaData& metadata) {
...
@@ -153,6 +143,35 @@ butil::Status FlvWriter::Write(const RtmpMetaData& metadata) {
return
butil
::
Status
::
OK
();
return
butil
::
Status
::
OK
();
}
}
butil
::
Status
FlvWriter
::
Write
(
const
RtmpCuePoint
&
cuepoint
)
{
butil
::
IOBuf
req_buf
;
{
butil
::
IOBufAsZeroCopyOutputStream
zc_stream
(
&
req_buf
);
AMFOutputStream
ostream
(
&
zc_stream
);
WriteAMFString
(
RTMP_AMF0_SET_DATAFRAME
,
&
ostream
);
WriteAMFString
(
RTMP_AMF0_ON_CUE_POINT
,
&
ostream
);
WriteAMFObject
(
cuepoint
.
data
,
&
ostream
);
if
(
!
ostream
.
good
())
{
return
butil
::
Status
(
EINVAL
,
"Fail to serialize cuepoint"
);
}
}
return
WriteScriptData
(
req_buf
,
cuepoint
.
timestamp
);
}
butil
::
Status
FlvWriter
::
Write
(
const
RtmpMetaData
&
metadata
)
{
butil
::
IOBuf
req_buf
;
{
butil
::
IOBufAsZeroCopyOutputStream
zc_stream
(
&
req_buf
);
AMFOutputStream
ostream
(
&
zc_stream
);
WriteAMFString
(
RTMP_AMF0_ON_META_DATA
,
&
ostream
);
WriteAMFObject
(
metadata
.
data
,
&
ostream
);
if
(
!
ostream
.
good
())
{
return
butil
::
Status
(
EINVAL
,
"Fail to serialize metadata"
);
}
}
return
WriteScriptData
(
req_buf
,
metadata
.
timestamp
);
}
FlvReader
::
FlvReader
(
butil
::
IOBuf
*
buf
)
FlvReader
::
FlvReader
(
butil
::
IOBuf
*
buf
)
:
_read_header
(
false
),
_buf
(
buf
)
{
:
_read_header
(
false
),
_buf
(
buf
)
{
}
}
...
@@ -1262,6 +1281,22 @@ int RtmpStreamBase::SendControlMessage(
...
@@ -1262,6 +1281,22 @@ int RtmpStreamBase::SendControlMessage(
return
_rtmpsock
->
Write
(
msg
);
return
_rtmpsock
->
Write
(
msg
);
}
}
int
RtmpStreamBase
::
SendCuePoint
(
const
RtmpCuePoint
&
cuepoint
)
{
butil
::
IOBuf
req_buf
;
{
butil
::
IOBufAsZeroCopyOutputStream
zc_stream
(
&
req_buf
);
AMFOutputStream
ostream
(
&
zc_stream
);
WriteAMFString
(
RTMP_AMF0_SET_DATAFRAME
,
&
ostream
);
WriteAMFString
(
RTMP_AMF0_ON_CUE_POINT
,
&
ostream
);
WriteAMFObject
(
cuepoint
.
data
,
&
ostream
);
if
(
!
ostream
.
good
())
{
LOG
(
ERROR
)
<<
"Fail to serialize cuepoint"
;
return
-
1
;
}
}
return
SendMessage
(
cuepoint
.
timestamp
,
policy
::
RTMP_MESSAGE_DATA_AMF0
,
req_buf
);
}
int
RtmpStreamBase
::
SendMetaData
(
const
RtmpMetaData
&
metadata
,
int
RtmpStreamBase
::
SendMetaData
(
const
RtmpMetaData
&
metadata
,
const
butil
::
StringPiece
&
name
)
{
const
butil
::
StringPiece
&
name
)
{
butil
::
IOBuf
req_buf
;
butil
::
IOBuf
req_buf
;
...
@@ -1441,6 +1476,11 @@ void RtmpStreamBase::OnUserData(void*) {
...
@@ -1441,6 +1476,11 @@ void RtmpStreamBase::OnUserData(void*) {
<<
"] ignored UserData{}"
;
<<
"] ignored UserData{}"
;
}
}
void
RtmpStreamBase
::
OnCuePoint
(
RtmpCuePoint
*
cuepoint
)
{
LOG
(
INFO
)
<<
remote_side
()
<<
'['
<<
stream_id
()
<<
"] ignored CuePoint{"
<<
cuepoint
->
data
<<
'}'
;
}
void
RtmpStreamBase
::
OnMetaData
(
RtmpMetaData
*
metadata
,
const
butil
::
StringPiece
&
name
)
{
void
RtmpStreamBase
::
OnMetaData
(
RtmpMetaData
*
metadata
,
const
butil
::
StringPiece
&
name
)
{
LOG
(
INFO
)
<<
remote_side
()
<<
'['
<<
stream_id
()
LOG
(
INFO
)
<<
remote_side
()
<<
'['
<<
stream_id
()
<<
"] ignored MetaData{"
<<
metadata
->
data
<<
'}'
<<
"] ignored MetaData{"
<<
metadata
->
data
<<
'}'
...
@@ -1500,6 +1540,13 @@ void RtmpStreamBase::CallOnUserData(void* data) {
...
@@ -1500,6 +1540,13 @@ void RtmpStreamBase::CallOnUserData(void* data) {
}
}
}
}
void
RtmpStreamBase
::
CallOnCuePoint
(
RtmpCuePoint
*
obj
)
{
if
(
BeginProcessingMessage
(
"OnCuePoint()"
))
{
OnCuePoint
(
obj
);
EndProcessingMessage
();
}
}
void
RtmpStreamBase
::
CallOnMetaData
(
RtmpMetaData
*
obj
,
const
butil
::
StringPiece
&
name
)
{
void
RtmpStreamBase
::
CallOnMetaData
(
RtmpMetaData
*
obj
,
const
butil
::
StringPiece
&
name
)
{
if
(
BeginProcessingMessage
(
"OnMetaData()"
))
{
if
(
BeginProcessingMessage
(
"OnMetaData()"
))
{
OnMetaData
(
obj
,
name
);
OnMetaData
(
obj
,
name
);
...
@@ -2241,6 +2288,10 @@ void RetryingClientMessageHandler::OnUserData(void* msg) {
...
@@ -2241,6 +2288,10 @@ void RetryingClientMessageHandler::OnUserData(void* msg) {
_parent
->
CallOnUserData
(
msg
);
_parent
->
CallOnUserData
(
msg
);
}
}
void
RetryingClientMessageHandler
::
OnCuePoint
(
brpc
::
RtmpCuePoint
*
cuepoint
)
{
_parent
->
CallOnCuePoint
(
cuepoint
);
}
void
RetryingClientMessageHandler
::
OnMetaData
(
brpc
::
RtmpMetaData
*
metadata
,
const
butil
::
StringPiece
&
name
)
{
void
RetryingClientMessageHandler
::
OnMetaData
(
brpc
::
RtmpMetaData
*
metadata
,
const
butil
::
StringPiece
&
name
)
{
_parent
->
CallOnMetaData
(
metadata
,
name
);
_parent
->
CallOnMetaData
(
metadata
,
name
);
}
}
...
@@ -2403,6 +2454,14 @@ int RtmpRetryingClientStream::AcquireStreamToSend(
...
@@ -2403,6 +2454,14 @@ int RtmpRetryingClientStream::AcquireStreamToSend(
return
0
;
return
0
;
}
}
int
RtmpRetryingClientStream
::
SendCuePoint
(
const
RtmpCuePoint
&
obj
)
{
butil
::
intrusive_ptr
<
RtmpStreamBase
>
ptr
;
if
(
AcquireStreamToSend
(
&
ptr
)
!=
0
)
{
return
-
1
;
}
return
ptr
->
SendCuePoint
(
obj
);
}
int
RtmpRetryingClientStream
::
SendMetaData
(
const
RtmpMetaData
&
obj
,
const
butil
::
StringPiece
&
name
)
{
int
RtmpRetryingClientStream
::
SendMetaData
(
const
RtmpMetaData
&
obj
,
const
butil
::
StringPiece
&
name
)
{
butil
::
intrusive_ptr
<
RtmpStreamBase
>
ptr
;
butil
::
intrusive_ptr
<
RtmpStreamBase
>
ptr
;
if
(
AcquireStreamToSend
(
&
ptr
)
!=
0
)
{
if
(
AcquireStreamToSend
(
&
ptr
)
!=
0
)
{
...
...
src/brpc/rtmp.h
View file @
8fa80df3
...
@@ -370,6 +370,11 @@ struct RtmpMetaData {
...
@@ -370,6 +370,11 @@ struct RtmpMetaData {
AMFObject
data
;
AMFObject
data
;
};
};
struct
RtmpCuePoint
{
uint32_t
timestamp
;
AMFObject
data
;
};
struct
RtmpSharedObjectMessage
{
struct
RtmpSharedObjectMessage
{
// Not implemented yet.
// Not implemented yet.
};
};
...
@@ -385,10 +390,15 @@ public:
...
@@ -385,10 +390,15 @@ public:
// Start appending FLV tags into the buffer
// Start appending FLV tags into the buffer
explicit
FlvWriter
(
butil
::
IOBuf
*
buf
);
explicit
FlvWriter
(
butil
::
IOBuf
*
buf
);
// Append a video/audio/metadata message into the output buffer.
// Append a video/audio/metadata
/cuepoint
message into the output buffer.
butil
::
Status
Write
(
const
RtmpVideoMessage
&
);
butil
::
Status
Write
(
const
RtmpVideoMessage
&
);
butil
::
Status
Write
(
const
RtmpAudioMessage
&
);
butil
::
Status
Write
(
const
RtmpAudioMessage
&
);
butil
::
Status
Write
(
const
RtmpMetaData
&
);
butil
::
Status
Write
(
const
RtmpMetaData
&
);
butil
::
Status
Write
(
const
RtmpCuePoint
&
);
private
:
butil
::
Status
WriteScriptData
(
const
butil
::
IOBuf
&
req_buf
,
uint32_t
timestamp
);
private
:
private
:
bool
_write_header
;
bool
_write_header
;
butil
::
IOBuf
*
_buf
;
butil
::
IOBuf
*
_buf
;
...
@@ -510,12 +520,13 @@ public:
...
@@ -510,12 +520,13 @@ public:
// simultaneously.
// simultaneously.
// NOTE: Inputs can be modified and consumed.
// NOTE: Inputs can be modified and consumed.
virtual
void
OnUserData
(
void
*
msg
);
virtual
void
OnUserData
(
void
*
msg
);
virtual
void
OnCuePoint
(
RtmpCuePoint
*
);
virtual
void
OnMetaData
(
RtmpMetaData
*
,
const
butil
::
StringPiece
&
);
virtual
void
OnMetaData
(
RtmpMetaData
*
,
const
butil
::
StringPiece
&
);
virtual
void
OnSharedObjectMessage
(
RtmpSharedObjectMessage
*
msg
);
virtual
void
OnSharedObjectMessage
(
RtmpSharedObjectMessage
*
msg
);
virtual
void
OnAudioMessage
(
RtmpAudioMessage
*
msg
);
virtual
void
OnAudioMessage
(
RtmpAudioMessage
*
msg
);
virtual
void
OnVideoMessage
(
RtmpVideoMessage
*
msg
);
virtual
void
OnVideoMessage
(
RtmpVideoMessage
*
msg
);
// Will be called in the same thread before any OnMetaData/
// Will be called in the same thread before any OnMetaData/
OnCuePoint
// OnSharedObjectMessage/OnAudioMessage/OnVideoMessage are called.
// OnSharedObjectMessage/OnAudioMessage/OnVideoMessage are called.
virtual
void
OnFirstMessage
();
virtual
void
OnFirstMessage
();
...
@@ -526,6 +537,7 @@ public:
...
@@ -526,6 +537,7 @@ public:
// Send media messages to the peer.
// Send media messages to the peer.
// Returns 0 on success, -1 otherwise.
// Returns 0 on success, -1 otherwise.
virtual
int
SendCuePoint
(
const
RtmpCuePoint
&
);
virtual
int
SendMetaData
(
const
RtmpMetaData
&
,
virtual
int
SendMetaData
(
const
RtmpMetaData
&
,
const
butil
::
StringPiece
&
name
=
"onMetaData"
);
const
butil
::
StringPiece
&
name
=
"onMetaData"
);
virtual
int
SendSharedObjectMessage
(
const
RtmpSharedObjectMessage
&
msg
);
virtual
int
SendSharedObjectMessage
(
const
RtmpSharedObjectMessage
&
msg
);
...
@@ -571,7 +583,7 @@ public:
...
@@ -571,7 +583,7 @@ public:
bool
is_paused
()
const
{
return
_paused
;
}
bool
is_paused
()
const
{
return
_paused
;
}
// True if OnMetaData
or
OnXXXMessage() was ever called.
// True if OnMetaData
/OnCuePoint/
OnXXXMessage() was ever called.
bool
has_data_ever
()
const
{
return
_has_data_ever
;
}
bool
has_data_ever
()
const
{
return
_has_data_ever
;
}
// The underlying socket for reading/writing.
// The underlying socket for reading/writing.
...
@@ -603,6 +615,7 @@ friend class policy::OnServerStreamCreated;
...
@@ -603,6 +615,7 @@ friend class policy::OnServerStreamCreated;
bool
BeginProcessingMessage
(
const
char
*
fun_name
);
bool
BeginProcessingMessage
(
const
char
*
fun_name
);
void
EndProcessingMessage
();
void
EndProcessingMessage
();
void
CallOnUserData
(
void
*
data
);
void
CallOnUserData
(
void
*
data
);
void
CallOnCuePoint
(
RtmpCuePoint
*
);
void
CallOnMetaData
(
RtmpMetaData
*
,
const
butil
::
StringPiece
&
);
void
CallOnMetaData
(
RtmpMetaData
*
,
const
butil
::
StringPiece
&
);
void
CallOnSharedObjectMessage
(
RtmpSharedObjectMessage
*
msg
);
void
CallOnSharedObjectMessage
(
RtmpSharedObjectMessage
*
msg
);
void
CallOnAudioMessage
(
RtmpAudioMessage
*
msg
);
void
CallOnAudioMessage
(
RtmpAudioMessage
*
msg
);
...
@@ -612,7 +625,7 @@ friend class policy::OnServerStreamCreated;
...
@@ -612,7 +625,7 @@ friend class policy::OnServerStreamCreated;
bool
_is_client
;
bool
_is_client
;
bool
_paused
;
// Only used by RtmpServerStream
bool
_paused
;
// Only used by RtmpServerStream
bool
_stopped
;
// True when OnStop() was called.
bool
_stopped
;
// True when OnStop() was called.
bool
_processing_msg
;
// True when OnXXXMessage/OnMetaData are called.
bool
_processing_msg
;
// True when OnXXXMessage/OnMetaData
/OnCuePoint
are called.
bool
_has_data_ever
;
bool
_has_data_ever
;
uint32_t
_message_stream_id
;
uint32_t
_message_stream_id
;
uint32_t
_chunk_stream_id
;
uint32_t
_chunk_stream_id
;
...
@@ -874,6 +887,7 @@ class RtmpMessageHandler {
...
@@ -874,6 +887,7 @@ class RtmpMessageHandler {
public
:
public
:
virtual
void
OnPlayable
()
=
0
;
virtual
void
OnPlayable
()
=
0
;
virtual
void
OnUserData
(
void
*
)
=
0
;
virtual
void
OnUserData
(
void
*
)
=
0
;
virtual
void
OnCuePoint
(
brpc
::
RtmpCuePoint
*
cuepoint
)
=
0
;
virtual
void
OnMetaData
(
brpc
::
RtmpMetaData
*
metadata
,
const
butil
::
StringPiece
&
name
)
=
0
;
virtual
void
OnMetaData
(
brpc
::
RtmpMetaData
*
metadata
,
const
butil
::
StringPiece
&
name
)
=
0
;
virtual
void
OnAudioMessage
(
brpc
::
RtmpAudioMessage
*
msg
)
=
0
;
virtual
void
OnAudioMessage
(
brpc
::
RtmpAudioMessage
*
msg
)
=
0
;
virtual
void
OnVideoMessage
(
brpc
::
RtmpVideoMessage
*
msg
)
=
0
;
virtual
void
OnVideoMessage
(
brpc
::
RtmpVideoMessage
*
msg
)
=
0
;
...
@@ -891,6 +905,7 @@ public:
...
@@ -891,6 +905,7 @@ public:
void
OnPlayable
();
void
OnPlayable
();
void
OnUserData
(
void
*
);
void
OnUserData
(
void
*
);
void
OnCuePoint
(
brpc
::
RtmpCuePoint
*
cuepoint
);
void
OnMetaData
(
brpc
::
RtmpMetaData
*
metadata
,
const
butil
::
StringPiece
&
name
);
void
OnMetaData
(
brpc
::
RtmpMetaData
*
metadata
,
const
butil
::
StringPiece
&
name
);
void
OnAudioMessage
(
brpc
::
RtmpAudioMessage
*
msg
);
void
OnAudioMessage
(
brpc
::
RtmpAudioMessage
*
msg
);
void
OnVideoMessage
(
brpc
::
RtmpVideoMessage
*
msg
);
void
OnVideoMessage
(
brpc
::
RtmpVideoMessage
*
msg
);
...
@@ -934,6 +949,7 @@ public:
...
@@ -934,6 +949,7 @@ public:
// If the stream is recreated, following methods may return -1 and set
// If the stream is recreated, following methods may return -1 and set
// errno to ERTMPPUBLISHABLE for once. (so that users can be notified to
// errno to ERTMPPUBLISHABLE for once. (so that users can be notified to
// resend metadata or header messages).
// resend metadata or header messages).
int
SendCuePoint
(
const
RtmpCuePoint
&
);
int
SendMetaData
(
const
RtmpMetaData
&
,
int
SendMetaData
(
const
RtmpMetaData
&
,
const
butil
::
StringPiece
&
name
=
"onMetaData"
);
const
butil
::
StringPiece
&
name
=
"onMetaData"
);
int
SendSharedObjectMessage
(
const
RtmpSharedObjectMessage
&
msg
);
int
SendSharedObjectMessage
(
const
RtmpSharedObjectMessage
&
msg
);
...
@@ -949,7 +965,7 @@ public:
...
@@ -949,7 +965,7 @@ public:
void
StopCurrentStream
();
void
StopCurrentStream
();
// If a sub stream was created, this method will be called in the same
// If a sub stream was created, this method will be called in the same
// thread before any OnMetaData/OnSharedObjectMessage/OnAudioMessage/
// thread before any OnMetaData/On
CuePoint/On
SharedObjectMessage/OnAudioMessage/
// OnVideoMessage are called.
// OnVideoMessage are called.
virtual
void
OnPlayable
();
virtual
void
OnPlayable
();
...
...
src/butil/containers/hash_tables.h
View file @
8fa80df3
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
// of hash_map. Allows all platforms to use |butil::hash_map| and
// of hash_map. Allows all platforms to use |butil::hash_map| and
// |butil::hash_set|.
// |butil::hash_set|.
// eg:
// eg:
// butil::hash_map<int> my_map;
// butil::hash_map<int
, std::string
> my_map;
// butil::hash_set<int> my_set;
// butil::hash_set<int> my_set;
//
//
// NOTE: It is an explicit non-goal of this class to provide a generic hash
// NOTE: It is an explicit non-goal of this class to provide a generic hash
...
...
test/brpc_streaming_rpc_unittest.cpp
View file @
8fa80df3
...
@@ -68,8 +68,8 @@ TEST_F(StreamingRpcTest, sanity) {
...
@@ -68,8 +68,8 @@ TEST_F(StreamingRpcTest, sanity) {
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
brpc
::
Controller
cntl
;
brpc
::
Controller
cntl
;
brpc
::
StreamId
request_stream
;
brpc
::
StreamId
request_stream
;
brpc
::
ScopedStream
stream_guard
(
request_stream
);
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
NULL
));
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
NULL
));
brpc
::
ScopedStream
stream_guard
(
request_stream
);
test
::
EchoService_Stub
stub
(
&
channel
);
test
::
EchoService_Stub
stub
(
&
channel
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
...
@@ -146,10 +146,10 @@ TEST_F(StreamingRpcTest, received_in_order) {
...
@@ -146,10 +146,10 @@ TEST_F(StreamingRpcTest, received_in_order) {
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
brpc
::
Controller
cntl
;
brpc
::
Controller
cntl
;
brpc
::
StreamId
request_stream
;
brpc
::
StreamId
request_stream
;
brpc
::
ScopedStream
stream_guard
(
request_stream
);
brpc
::
StreamOptions
request_stream_options
;
brpc
::
StreamOptions
request_stream_options
;
request_stream_options
.
max_buf_size
=
0
;
request_stream_options
.
max_buf_size
=
0
;
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
&
request_stream_options
));
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
&
request_stream_options
));
brpc
::
ScopedStream
stream_guard
(
request_stream
);
test
::
EchoService_Stub
stub
(
&
channel
);
test
::
EchoService_Stub
stub
(
&
channel
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
...
@@ -293,10 +293,10 @@ TEST_F(StreamingRpcTest, auto_close_if_host_socket_closed) {
...
@@ -293,10 +293,10 @@ TEST_F(StreamingRpcTest, auto_close_if_host_socket_closed) {
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
brpc
::
Controller
cntl
;
brpc
::
Controller
cntl
;
brpc
::
StreamId
request_stream
;
brpc
::
StreamId
request_stream
;
brpc
::
ScopedStream
stream_guard
(
request_stream
);
brpc
::
StreamOptions
request_stream_options
;
brpc
::
StreamOptions
request_stream_options
;
request_stream_options
.
max_buf_size
=
sizeof
(
uint32_t
)
*
N
;
request_stream_options
.
max_buf_size
=
sizeof
(
uint32_t
)
*
N
;
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
&
request_stream_options
));
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
&
request_stream_options
));
brpc
::
ScopedStream
stream_guard
(
request_stream
);
test
::
EchoService_Stub
stub
(
&
channel
);
test
::
EchoService_Stub
stub
(
&
channel
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
...
@@ -338,10 +338,10 @@ TEST_F(StreamingRpcTest, idle_timeout) {
...
@@ -338,10 +338,10 @@ TEST_F(StreamingRpcTest, idle_timeout) {
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
brpc
::
Controller
cntl
;
brpc
::
Controller
cntl
;
brpc
::
StreamId
request_stream
;
brpc
::
StreamId
request_stream
;
brpc
::
ScopedStream
stream_guard
(
request_stream
);
brpc
::
StreamOptions
request_stream_options
;
brpc
::
StreamOptions
request_stream_options
;
request_stream_options
.
max_buf_size
=
sizeof
(
uint32_t
)
*
N
;
request_stream_options
.
max_buf_size
=
sizeof
(
uint32_t
)
*
N
;
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
&
request_stream_options
));
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
&
request_stream_options
));
brpc
::
ScopedStream
stream_guard
(
request_stream
);
test
::
EchoService_Stub
stub
(
&
channel
);
test
::
EchoService_Stub
stub
(
&
channel
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
...
@@ -351,8 +351,8 @@ TEST_F(StreamingRpcTest, idle_timeout) {
...
@@ -351,8 +351,8 @@ TEST_F(StreamingRpcTest, idle_timeout) {
usleep
(
100
);
usleep
(
100
);
}
}
ASSERT_FALSE
(
handler
.
failed
());
ASSERT_FALSE
(
handler
.
failed
());
ASSERT_TRUE
(
handler
.
idle_times
()
>=
4
&&
handler
.
idle_times
()
<=
6
)
//
ASSERT_TRUE(handler.idle_times() >= 4 && handler.idle_times() <= 6)
<<
handler
.
idle_times
();
//
<< handler.idle_times();
ASSERT_EQ
(
0
,
handler
.
_expected_next_value
);
ASSERT_EQ
(
0
,
handler
.
_expected_next_value
);
}
}
...
@@ -423,13 +423,13 @@ TEST_F(StreamingRpcTest, ping_pong) {
...
@@ -423,13 +423,13 @@ TEST_F(StreamingRpcTest, ping_pong) {
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
ASSERT_EQ
(
0
,
channel
.
Init
(
"127.0.0.1:9007"
,
NULL
));
brpc
::
Controller
cntl
;
brpc
::
Controller
cntl
;
brpc
::
StreamId
request_stream
;
brpc
::
StreamId
request_stream
;
brpc
::
ScopedStream
stream_guard
(
request_stream
);
brpc
::
StreamOptions
request_stream_options
;
brpc
::
StreamOptions
request_stream_options
;
PingPongHandler
reqh
;
PingPongHandler
reqh
;
reqh
.
_expected_next_value
=
1
;
reqh
.
_expected_next_value
=
1
;
request_stream_options
.
handler
=
&
reqh
;
request_stream_options
.
handler
=
&
reqh
;
request_stream_options
.
max_buf_size
=
sizeof
(
uint32_t
)
*
N
;
request_stream_options
.
max_buf_size
=
sizeof
(
uint32_t
)
*
N
;
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
&
request_stream_options
));
ASSERT_EQ
(
0
,
StreamCreate
(
&
request_stream
,
cntl
,
&
request_stream_options
));
brpc
::
ScopedStream
stream_guard
(
request_stream
);
test
::
EchoService_Stub
stub
(
&
channel
);
test
::
EchoService_Stub
stub
(
&
channel
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
ASSERT_FALSE
(
cntl
.
Failed
())
<<
cntl
.
ErrorText
()
<<
" request_stream="
<<
request_stream
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment