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
4b912063
Commit
4b912063
authored
Jul 04, 2018
by
wangxuefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert client.cpp and realpath
parent
c54466eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
config_brpc.sh
config_brpc.sh
+2
-2
client.cpp
example/echo_c++/client.cpp
+15
-9
No files found.
config_brpc.sh
View file @
4b912063
...
@@ -34,8 +34,8 @@ eval set -- "$TEMP"
...
@@ -34,8 +34,8 @@ eval set -- "$TEMP"
# Convert to abspath always so that generated mk is include-able from everywhere
# Convert to abspath always so that generated mk is include-able from everywhere
while
true
;
do
while
true
;
do
case
"
$1
"
in
case
"
$1
"
in
--headers
)
HDRS_IN
=
"
$(
rea
dlink
-e
$2
)
"
;
shift
2
;;
--headers
)
HDRS_IN
=
"
$(
rea
lpath
$2
)
"
;
shift
2
;;
--libs
)
LIBS_IN
=
"
$(
rea
dlink
-e
$2
)
"
;
shift
2
;;
--libs
)
LIBS_IN
=
"
$(
rea
lpath
$2
)
"
;
shift
2
;;
--cc
)
CC
=
$2
;
shift
2
;;
--cc
)
CC
=
$2
;
shift
2
;;
--cxx
)
CXX
=
$2
;
shift
2
;;
--cxx
)
CXX
=
$2
;
shift
2
;;
--with-glog
)
WITH_GLOG
=
1
;
shift
1
;;
--with-glog
)
WITH_GLOG
=
1
;
shift
1
;;
...
...
example/echo_c++/client.cpp
100755 → 100644
View file @
4b912063
...
@@ -22,9 +22,9 @@
...
@@ -22,9 +22,9 @@
DEFINE_string
(
attachment
,
"foo"
,
"Carry this along with requests"
);
DEFINE_string
(
attachment
,
"foo"
,
"Carry this along with requests"
);
DEFINE_string
(
protocol
,
"baidu_std"
,
"Protocol type. Defined in src/brpc/options.proto"
);
DEFINE_string
(
protocol
,
"baidu_std"
,
"Protocol type. Defined in src/brpc/options.proto"
);
DEFINE_string
(
connection_type
,
"
pooled
"
,
"Connection type. Available values: single, pooled, short"
);
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
(
server
,
"0.0.0.0:8000"
,
"IP Address of server"
);
DEFINE_string
(
load_balancer
,
"
rr
"
,
"The algorithm for load balancing"
);
DEFINE_string
(
load_balancer
,
""
,
"The algorithm for load balancing"
);
DEFINE_int32
(
timeout_ms
,
100
,
"RPC timeout in milliseconds"
);
DEFINE_int32
(
timeout_ms
,
100
,
"RPC timeout in milliseconds"
);
DEFINE_int32
(
max_retry
,
3
,
"Max retries(not including the first RPC)"
);
DEFINE_int32
(
max_retry
,
3
,
"Max retries(not including the first RPC)"
);
DEFINE_int32
(
interval_ms
,
1000
,
"Milliseconds between consecutive requests"
);
DEFINE_int32
(
interval_ms
,
1000
,
"Milliseconds between consecutive requests"
);
...
@@ -44,7 +44,7 @@ int main(int argc, char* argv[]) {
...
@@ -44,7 +44,7 @@ int main(int argc, char* argv[]) {
options
.
connection_type
=
FLAGS_connection_type
;
options
.
connection_type
=
FLAGS_connection_type
;
options
.
timeout_ms
=
FLAGS_timeout_ms
/*milliseconds*/
;
options
.
timeout_ms
=
FLAGS_timeout_ms
/*milliseconds*/
;
options
.
max_retry
=
FLAGS_max_retry
;
options
.
max_retry
=
FLAGS_max_retry
;
if
(
channel
.
Init
(
"file://server.list"
,
FLAGS_load_balancer
.
c_str
(),
&
options
)
!=
0
)
{
if
(
channel
.
Init
(
FLAGS_server
.
c_str
()
,
FLAGS_load_balancer
.
c_str
(),
&
options
)
!=
0
)
{
LOG
(
ERROR
)
<<
"Fail to initialize channel"
;
LOG
(
ERROR
)
<<
"Fail to initialize channel"
;
return
-
1
;
return
-
1
;
}
}
...
@@ -77,15 +77,21 @@ int main(int argc, char* argv[]) {
...
@@ -77,15 +77,21 @@ int main(int argc, char* argv[]) {
// the response comes back or error occurs(including timedout).
// the response comes back or error occurs(including timedout).
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
stub
.
Echo
(
&
cntl
,
&
request
,
&
response
,
NULL
);
if
(
!
cntl
.
Failed
())
{
if
(
!
cntl
.
Failed
())
{
LOG
(
INFO
)
<<
"Received response from "
<<
cntl
.
remote_side
()
if
(
cntl
.
response_attachment
().
empty
())
{
<<
" to "
<<
cntl
.
local_side
()
LOG
(
INFO
)
<<
"Received response from "
<<
cntl
.
remote_side
()
<<
": "
<<
response
.
message
()
<<
" (attached="
<<
": "
<<
response
.
message
()
<<
cntl
.
response_attachment
()
<<
")"
<<
" latency="
<<
cntl
.
latency_us
()
<<
"us"
;
<<
" latency="
<<
cntl
.
latency_us
()
<<
"us"
;
}
else
{
LOG
(
INFO
)
<<
"Received response from "
<<
cntl
.
remote_side
()
<<
" to "
<<
cntl
.
local_side
()
<<
": "
<<
response
.
message
()
<<
" (attached="
<<
cntl
.
response_attachment
()
<<
")"
<<
" latency="
<<
cntl
.
latency_us
()
<<
"us"
;
}
}
else
{
}
else
{
LOG
(
WARNING
)
<<
cntl
.
ErrorText
();
LOG
(
WARNING
)
<<
cntl
.
ErrorText
();
}
}
//
usleep(FLAGS_interval_ms * 1000L);
usleep
(
FLAGS_interval_ms
*
1000L
);
}
}
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
LOG
(
INFO
)
<<
"EchoClient is going to quit"
;
...
...
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