Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ademco_hb
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
ademco_hb
Commits
fcbc9da3
Commit
fcbc9da3
authored
Jul 28, 2020
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bench_client
parent
cea08cdf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
bench_client.cpp
examples/bench_client/bench_client.cpp
+5
-3
No files found.
examples/bench_client/bench_client.cpp
View file @
fcbc9da3
...
...
@@ -67,8 +67,9 @@ int64_t totalEncodeTime = 0;
int64_t
totalDecodeTime
=
0
;
struct
Session
{
int
id
=
0
;
int
fd
=
0
;
bufferevent
*
bev
=
nullptr
;
int
id
=
0
;
std
::
string
acct
=
{};
size_t
ademco_id
=
0
;
uint16_t
seq
=
0
;
...
...
@@ -166,7 +167,7 @@ void timer_cb(evutil_socket_t fd, short what, void* arg)
//bufferevent_free(bev);
//evutil_closesocket(fd);
//bufferevent_disable(
bev, EV_WRITE);
bufferevent_disable
(
session
->
bev
,
EV_WRITE
);
// SHUT_WR
shutdown
(
session
->
fd
,
1
);
}
...
...
@@ -182,7 +183,7 @@ void eventcb(struct bufferevent* bev, short events, void* user_data)
{
std
::
lock_guard
<
std
::
mutex
>
lg
(
mutex
);
printf
(
"live connections %d
\n
"
,
++
session_connected
);
if
(
session_connected
==
session_count
*
thread_count
)
{
if
(
session_connected
==
session_count
)
{
printf
(
"All connected
\n
"
);
}
}
...
...
@@ -254,6 +255,7 @@ event_base* init_thread(const sockaddr_in& sin, int session_start, int session_p
exit
(
-
1
);
}
auto
session
=
new
Session
();
session
->
bev
=
bev
;
session
->
id
=
i
+
session_start
;
session
->
acct
=
std
::
string
(
"861234567890"
)
+
std
::
to_string
(
i
+
session_start
);
session
->
ademco_id
=
i
+
session_start
;
...
...
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