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
d02badcf
Commit
d02badcf
authored
Sep 29, 2018
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change protocol name from h2c to h2
parent
592d24b4
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
26 additions
and
32 deletions
+26
-32
client.cpp
example/cascade_echo_c++/client.cpp
+3
-5
client.cpp
example/echo_c++/client.cpp
+4
-6
client.cpp
example/echo_c++_hulu_pbrpc/client.cpp
+1
-1
client.cpp
example/grpc_c++/client.cpp
+1
-1
benchmark_http.cpp
example/http_c++/benchmark_http.cpp
+1
-1
http_client.cpp
example/http_c++/http_client.cpp
+1
-1
client.cpp
example/multi_threaded_echo_c++/client.cpp
+3
-5
client.cpp
example/multi_threaded_echo_fns_c++/client.cpp
+3
-5
connections_service.cpp
src/brpc/builtin/connections_service.cpp
+4
-0
global.cpp
src/brpc/global.cpp
+1
-1
server.cpp
src/brpc/server.cpp
+1
-3
brpc_grpc_protocol_unittest.cpp
test/brpc_grpc_protocol_unittest.cpp
+1
-1
brpc_http_rpc_protocol_unittest.cpp
test/brpc_http_rpc_protocol_unittest.cpp
+2
-2
No files found.
example/cascade_echo_c++/client.cpp
View file @
d02badcf
...
...
@@ -61,11 +61,9 @@ void* sender(void* arg) {
}
cntl
.
set_log_id
(
log_id
++
);
// set by user
if
(
FLAGS_protocol
!=
"http"
&&
FLAGS_protocol
!=
"h2c"
)
{
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl
.
request_attachment
().
append
(
FLAGS_attachment
);
}
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl
.
request_attachment
().
append
(
FLAGS_attachment
);
// Because `done'(last parameter) is NULL, this function waits until
// the response comes back or error occurs(including timedout).
...
...
example/echo_c++/client.cpp
View file @
d02badcf
...
...
@@ -20,7 +20,7 @@
#include <brpc/channel.h>
#include "echo.pb.h"
DEFINE_string
(
attachment
,
"
foo
"
,
"Carry this along with requests"
);
DEFINE_string
(
attachment
,
""
,
"Carry this along with requests"
);
DEFINE_string
(
protocol
,
"baidu_std"
,
"Protocol type. Defined in src/brpc/options.proto"
);
DEFINE_string
(
connection_type
,
""
,
"Connection type. Available values: single, pooled, short"
);
DEFINE_string
(
server
,
"0.0.0.0:8000"
,
"IP Address of server"
);
...
...
@@ -64,11 +64,9 @@ int main(int argc, char* argv[]) {
request
.
set_message
(
"hello world"
);
cntl
.
set_log_id
(
log_id
++
);
// set by user
if
(
FLAGS_protocol
!=
"http"
&&
FLAGS_protocol
!=
"h2c"
)
{
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl
.
request_attachment
().
append
(
FLAGS_attachment
);
}
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl
.
request_attachment
().
append
(
FLAGS_attachment
);
// Because `done'(last parameter) is NULL, this function waits until
// the response comes back or error occurs(including timedout).
...
...
example/echo_c++_hulu_pbrpc/client.cpp
View file @
d02badcf
...
...
@@ -21,7 +21,7 @@
#include <brpc/policy/hulu_pbrpc_controller.h>
#include "echo.pb.h"
DEFINE_string
(
attachment
,
"
foo
"
,
"Carry this along with requests"
);
DEFINE_string
(
attachment
,
""
,
"Carry this along with requests"
);
DEFINE_string
(
connection_type
,
""
,
"Connection type. Available values: single, pooled, short"
);
DEFINE_string
(
server
,
"0.0.0.0:8000"
,
"IP Address of server"
);
DEFINE_string
(
load_balancer
,
""
,
"The algorithm for load balancing"
);
...
...
example/grpc_c++/client.cpp
View file @
d02badcf
...
...
@@ -21,7 +21,7 @@
#include <brpc/channel.h>
#include "helloworld.pb.h"
DEFINE_string
(
protocol
,
"h2
c
"
,
"Protocol type. Defined in src/brpc/options.proto"
);
DEFINE_string
(
protocol
,
"h2"
,
"Protocol type. Defined in src/brpc/options.proto"
);
DEFINE_string
(
server
,
"0.0.0.0:50051"
,
"IP Address of server"
);
DEFINE_string
(
load_balancer
,
""
,
"The algorithm for load balancing"
);
DEFINE_int32
(
timeout_ms
,
100
,
"RPC timeout in milliseconds"
);
...
...
example/http_c++/benchmark_http.cpp
View file @
d02badcf
...
...
@@ -31,7 +31,7 @@ DEFINE_int32(timeout_ms, 100, "RPC timeout in milliseconds");
DEFINE_int32
(
max_retry
,
3
,
"Max retries(not including the first RPC)"
);
DEFINE_bool
(
dont_fail
,
false
,
"Print fatal when some call failed"
);
DEFINE_int32
(
dummy_port
,
-
1
,
"Launch dummy server at this port"
);
DEFINE_string
(
protocol
,
"http"
,
"
http or h2c
"
);
DEFINE_string
(
protocol
,
"http"
,
"
Client-side protocol
"
);
bvar
::
LatencyRecorder
g_latency_recorder
(
"client"
);
...
...
example/http_c++/http_client.cpp
View file @
d02badcf
...
...
@@ -27,7 +27,7 @@ DEFINE_string(d, "", "POST this data to the http server");
DEFINE_string
(
load_balancer
,
""
,
"The algorithm for load balancing"
);
DEFINE_int32
(
timeout_ms
,
1000
,
"RPC timeout in milliseconds"
);
DEFINE_int32
(
max_retry
,
3
,
"Max retries(not including the first RPC)"
);
DEFINE_string
(
protocol
,
"http"
,
"
http or h2c
"
);
DEFINE_string
(
protocol
,
"http"
,
"
Client-side protocol
"
);
namespace
brpc
{
DECLARE_bool
(
http_verbose
);
...
...
example/multi_threaded_echo_c++/client.cpp
View file @
d02badcf
...
...
@@ -57,11 +57,9 @@ static void* sender(void* arg) {
request
.
set_message
(
g_request
);
cntl
.
set_log_id
(
log_id
++
);
// set by user
if
(
FLAGS_protocol
!=
"http"
&&
FLAGS_protocol
!=
"h2c"
)
{
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl
.
request_attachment
().
append
(
g_attachment
);
}
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl
.
request_attachment
().
append
(
g_attachment
);
// Because `done'(last parameter) is NULL, this function waits until
// the response comes back or error occurs(including timedout).
...
...
example/multi_threaded_echo_fns_c++/client.cpp
View file @
d02badcf
...
...
@@ -61,11 +61,9 @@ static void* sender(void* arg) {
const
int
input
=
((
thread_index
&
0xFFF
)
<<
20
)
|
(
log_id
&
0xFFFFF
);
request
.
set_value
(
input
);
cntl
.
set_log_id
(
log_id
++
);
// set by user
if
(
FLAGS_protocol
!=
"http"
&&
FLAGS_protocol
!=
"h2c"
)
{
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl
.
request_attachment
().
append
(
g_attachment
);
}
// Set attachment which is wired to network directly instead of
// being serialized into protobuf messages.
cntl
.
request_attachment
().
append
(
g_attachment
);
// Because `done'(last parameter) is NULL, this function waits until
// the response comes back or error occurs(including timedout).
...
...
src/brpc/builtin/connections_service.cpp
View file @
d02badcf
...
...
@@ -230,6 +230,10 @@ void ConnectionsService::PrintConnections(
if
(
strcmp
(
pref_prot
,
"unknown"
)
==
0
)
{
// Show unknown protocol as - to be consistent with other columns.
pref_prot
=
"-"
;
}
else
if
(
strcmp
(
pref_prot
,
"h2"
)
==
0
)
{
if
(
!
ptr
->
is_ssl
())
{
pref_prot
=
"h2c"
;
}
}
ptr
->
GetStat
(
&
stat
);
PrintRealDateTime
(
os
,
ptr
->
_reset_fd_real_us
);
...
...
src/brpc/global.cpp
View file @
d02badcf
...
...
@@ -403,7 +403,7 @@ static void GlobalInitializeOrDieImpl() {
VerifyHttpRequest
,
ParseHttpServerAddress
,
GetHttpMethodName
,
CONNECTION_TYPE_SINGLE
,
"h2
c
"
};
"h2"
};
if
(
RegisterProtocol
(
PROTOCOL_HTTP2
,
http2_protocol
)
!=
0
)
{
exit
(
1
);
}
...
...
src/brpc/server.cpp
View file @
d02badcf
...
...
@@ -535,9 +535,7 @@ bool is_http_protocol(const char* name) {
if
(
name
[
0
]
!=
'h'
)
{
return
false
;
}
return
strcmp
(
name
,
"http"
)
==
0
||
strcmp
(
name
,
"h2c"
)
==
0
||
strcmp
(
name
,
"h2"
)
==
0
;
return
strcmp
(
name
,
"http"
)
==
0
||
strcmp
(
name
,
"h2"
)
==
0
;
}
Acceptor
*
Server
::
BuildAcceptor
()
{
...
...
test/brpc_grpc_protocol_unittest.cpp
View file @
d02badcf
...
...
@@ -42,7 +42,7 @@ const std::string g_server_addr = "127.0.0.1:8011";
const
std
::
string
g_prefix
=
"Hello, "
;
const
std
::
string
g_req
=
"wyt"
;
const
int64_t
g_timeout_ms
=
1000
;
const
std
::
string
g_protocol
=
"h2
c
:grpc"
;
const
std
::
string
g_protocol
=
"h2:grpc"
;
class
MyGrpcService
:
public
::
test
::
GrpcService
{
public
:
...
...
test/brpc_http_rpc_protocol_unittest.cpp
View file @
d02badcf
...
...
@@ -976,7 +976,7 @@ TEST_F(HttpTest, http2_sanity) {
brpc
::
Channel
channel
;
brpc
::
ChannelOptions
options
;
options
.
protocol
=
"h2
c
"
;
options
.
protocol
=
"h2"
;
ASSERT_EQ
(
0
,
channel
.
Init
(
butil
::
EndPoint
(
butil
::
my_ip
(),
port
),
&
options
));
// 1) complete flow and
...
...
@@ -1179,7 +1179,7 @@ TEST_F(HttpTest, http2_not_closing_socket_when_rpc_timeout) {
EXPECT_EQ
(
0
,
server
.
Start
(
port
,
NULL
));
brpc
::
Channel
channel
;
brpc
::
ChannelOptions
options
;
options
.
protocol
=
"h2
c
"
;
options
.
protocol
=
"h2"
;
ASSERT_EQ
(
0
,
channel
.
Init
(
butil
::
EndPoint
(
butil
::
my_ip
(),
port
),
&
options
));
test
::
EchoRequest
req
;
...
...
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