Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
183cce17
Commit
183cce17
authored
Jun 08, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use bitmask instead of std::vector
parent
6df709b4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
9 deletions
+8
-9
examples/shrpx_io_control.cc
examples/shrpx_io_control.cc
+5
-5
examples/shrpx_io_control.h
examples/shrpx_io_control.h
+3
-4
No files found.
examples/shrpx_io_control.cc
View file @
183cce17
...
...
@@ -30,7 +30,7 @@ namespace shrpx {
IOControl
::
IOControl
(
bufferevent
*
bev
)
:
bev_
(
bev
),
ctrlv_
(
SHRPX_REASON_MAX
)
rdbits_
(
0
)
{}
IOControl
::~
IOControl
()
...
...
@@ -43,14 +43,14 @@ void IOControl::set_bev(bufferevent *bev)
void
IOControl
::
pause_read
(
IOCtrlReason
reason
)
{
ctrlv_
[
reason
]
=
1
;
rdbits_
|=
reason
;
bufferevent_disable
(
bev_
,
EV_READ
);
}
bool
IOControl
::
resume_read
(
IOCtrlReason
reason
)
{
ctrlv_
[
reason
]
=
0
;
if
(
std
::
find
(
ctrlv_
.
begin
(),
ctrlv_
.
end
(),
1
)
==
ctrlv_
.
end
()
)
{
rdbits_
&=
~
reason
;
if
(
rdbits_
==
0
)
{
bufferevent_enable
(
bev_
,
EV_READ
);
return
true
;
}
else
{
...
...
@@ -60,7 +60,7 @@ bool IOControl::resume_read(IOCtrlReason reason)
void
IOControl
::
force_resume_read
()
{
std
::
fill
(
ctrlv_
.
begin
(),
ctrlv_
.
end
(),
0
)
;
rdbits_
=
0
;
bufferevent_enable
(
bev_
,
EV_READ
);
}
...
...
examples/shrpx_io_control.h
View file @
183cce17
...
...
@@ -35,9 +35,8 @@
namespace
shrpx
{
enum
IOCtrlReason
{
SHRPX_NO_BUFFER
=
0
,
SHRPX_MSG_BLOCK
,
SHRPX_REASON_MAX
SHRPX_NO_BUFFER
=
1
<<
0
,
SHRPX_MSG_BLOCK
=
1
<<
1
};
class
IOControl
{
...
...
@@ -52,7 +51,7 @@ public:
void
force_resume_read
();
private:
bufferevent
*
bev_
;
std
::
vector
<
int
>
ctrlv
_
;
uint32_t
rdbits
_
;
};
}
// namespace shrpx
...
...
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