Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
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
pistache
Commits
ea393877
Unverified
Commit
ea393877
authored
Jan 12, 2020
by
Dennis Jenkins
Committed by
GitHub
Jan 12, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #660 from dennisjenkins75/master
Fixed several cppcheck findings.
parents
2aaa2311
ddf64a13
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
22 deletions
+26
-22
src/common/http.cc
src/common/http.cc
+2
-2
src/common/reactor.cc
src/common/reactor.cc
+7
-6
src/common/transport.cc
src/common/transport.cc
+12
-10
src/server/listener.cc
src/server/listener.cc
+3
-2
src/server/router.cc
src/server/router.cc
+2
-2
No files found.
src/common/http.cc
View file @
ea393877
...
@@ -408,7 +408,7 @@ namespace Private {
...
@@ -408,7 +408,7 @@ namespace Private {
StreamCursor
::
Token
chunkData
(
cursor
);
StreamCursor
::
Token
chunkData
(
cursor
);
const
ssize_t
available
=
cursor
.
remaining
();
const
ssize_t
available
=
cursor
.
remaining
();
if
((
available
+
message
->
body_
.
size
())
<
size
)
{
if
(
static_cast
<
ssize_t
>
(
available
+
message
->
body_
.
size
())
<
size
)
{
cursor
.
advance
(
available
);
cursor
.
advance
(
available
);
message
->
body_
.
append
(
chunkData
.
rawText
(),
available
);
message
->
body_
.
append
(
chunkData
.
rawText
(),
available
);
return
Incomplete
;
return
Incomplete
;
...
@@ -451,7 +451,7 @@ namespace Private {
...
@@ -451,7 +451,7 @@ namespace Private {
State
State
ParserBase
::
parse
()
{
ParserBase
::
parse
()
{
State
state
=
State
::
Again
;
State
state
;
do
{
do
{
Step
*
step
=
allSteps
[
currentStep
].
get
();
Step
*
step
=
allSteps
[
currentStep
].
get
();
state
=
step
->
apply
(
cursor
);
state
=
step
->
apply
(
cursor
);
...
...
src/common/reactor.cc
View file @
ea393877
...
@@ -195,8 +195,8 @@ private:
...
@@ -195,8 +195,8 @@ private:
uint64_t
value
;
uint64_t
value
;
std
::
tie
(
index
,
value
)
=
decodeTag
(
event
.
tag
);
std
::
tie
(
index
,
value
)
=
decodeTag
(
event
.
tag
);
auto
handler
=
handlers_
.
at
(
index
);
auto
handler
_
=
handlers_
.
at
(
index
);
auto
&
evs
=
fdHandlers
.
at
(
handler
);
auto
&
evs
=
fdHandlers
.
at
(
handler
_
);
evs
.
push_back
(
std
::
move
(
event
));
evs
.
push_back
(
std
::
move
(
event
));
}
}
...
@@ -460,10 +460,11 @@ private:
...
@@ -460,10 +460,11 @@ private:
struct
Worker
{
struct
Worker
{
explicit
Worker
(
Reactor
*
reactor
,
const
std
::
string
&
threadsName
)
{
explicit
Worker
(
Reactor
*
reactor
,
const
std
::
string
&
threadsName
)
:
threadsName_
=
threadsName
;
thread
(),
sync
.
reset
(
new
SyncImpl
(
reactor
));
sync
(
new
SyncImpl
(
reactor
)),
}
threadsName_
(
threadsName
)
{
}
~
Worker
()
{
~
Worker
()
{
if
(
thread
.
joinable
())
if
(
thread
.
joinable
())
...
...
src/common/transport.cc
View file @
ea393877
...
@@ -84,8 +84,8 @@ Transport::onReady(const Aio::FdSet& fds) {
...
@@ -84,8 +84,8 @@ Transport::onReady(const Aio::FdSet& fds) {
handleIncoming
(
peer
);
handleIncoming
(
peer
);
}
else
if
(
isTimerFd
(
tag
))
{
}
else
if
(
isTimerFd
(
tag
))
{
auto
it
=
timers
.
find
(
tag
.
value
());
auto
it
=
timers
.
find
(
tag
.
value
());
auto
&
entry
=
it
->
second
;
auto
&
entry
_
=
it
->
second
;
handleTimer
(
std
::
move
(
entry
));
handleTimer
(
std
::
move
(
entry
_
));
timers
.
erase
(
it
->
first
);
timers
.
erase
(
it
->
first
);
}
}
else
{
else
{
...
@@ -242,13 +242,14 @@ Transport::asyncWriteImpl(Fd fd)
...
@@ -242,13 +242,14 @@ Transport::asyncWriteImpl(Fd fd)
auto
ptr
=
raw
.
data
().
c_str
()
+
totalWritten
;
auto
ptr
=
raw
.
data
().
c_str
()
+
totalWritten
;
#ifdef PISTACHE_USE_SSL
#ifdef PISTACHE_USE_SSL
auto
it
=
peers
.
find
(
fd
);
auto
it
_
=
peers
.
find
(
fd
);
if
(
it
==
std
::
end
(
peers
))
if
(
it
_
==
std
::
end
(
peers
))
throw
std
::
runtime_error
(
"No peer found for fd: "
+
std
::
to_string
(
fd
));
throw
std
::
runtime_error
(
"No peer found for fd: "
+
std
::
to_string
(
fd
));
if
(
it
->
second
->
ssl
()
!=
NULL
)
{
if
(
it_
->
second
->
ssl
()
!=
NULL
)
{
bytesWritten
=
SSL_write
((
SSL
*
)
it
->
second
->
ssl
(),
ptr
,
len
);
auto
ssl_
=
static_cast
<
SSL
*>
(
it_
->
second
->
ssl
());
bytesWritten
=
SSL_write
(
ssl_
,
ptr
,
len
);
}
else
{
}
else
{
#endif
/* PISTACHE_USE_SSL */
#endif
/* PISTACHE_USE_SSL */
bytesWritten
=
::
send
(
fd
,
ptr
,
len
,
flags
);
bytesWritten
=
::
send
(
fd
,
ptr
,
len
,
flags
);
...
@@ -260,13 +261,14 @@ Transport::asyncWriteImpl(Fd fd)
...
@@ -260,13 +261,14 @@ Transport::asyncWriteImpl(Fd fd)
off_t
offset
=
totalWritten
;
off_t
offset
=
totalWritten
;
#ifdef PISTACHE_USE_SSL
#ifdef PISTACHE_USE_SSL
auto
it
=
peers
.
find
(
fd
);
auto
it
_
=
peers
.
find
(
fd
);
if
(
it
==
std
::
end
(
peers
))
if
(
it
_
==
std
::
end
(
peers
))
throw
std
::
runtime_error
(
"No peer found for fd: "
+
std
::
to_string
(
fd
));
throw
std
::
runtime_error
(
"No peer found for fd: "
+
std
::
to_string
(
fd
));
if
(
it
->
second
->
ssl
()
!=
NULL
)
{
if
(
it_
->
second
->
ssl
()
!=
NULL
)
{
bytesWritten
=
SSL_sendfile
((
SSL
*
)
it
->
second
->
ssl
(),
file
,
&
offset
,
len
);
auto
ssl_
=
static_cast
<
SSL
*>
(
it_
->
second
->
ssl
());
bytesWritten
=
SSL_sendfile
(
ssl_
,
file
,
&
offset
,
len
);
}
else
{
}
else
{
#endif
/* PISTACHE_USE_SSL */
#endif
/* PISTACHE_USE_SSL */
bytesWritten
=
::
sendfile
(
fd
,
file
,
&
offset
,
len
);
bytesWritten
=
::
sendfile
(
fd
,
file
,
&
offset
,
len
);
...
...
src/server/listener.cc
View file @
ea393877
...
@@ -78,6 +78,7 @@ Listener::Listener()
...
@@ -78,6 +78,7 @@ Listener::Listener()
,
reactor_
()
,
reactor_
()
,
transportKey
()
,
transportKey
()
,
useSSL_
(
false
)
,
useSSL_
(
false
)
,
ssl_ctx_
(
nullptr
)
{
}
{
}
Listener
::
Listener
(
const
Address
&
address
)
Listener
::
Listener
(
const
Address
&
address
)
...
@@ -92,8 +93,8 @@ Listener::Listener(const Address& address)
...
@@ -92,8 +93,8 @@ Listener::Listener(const Address& address)
,
reactor_
()
,
reactor_
()
,
transportKey
()
,
transportKey
()
,
useSSL_
(
false
)
,
useSSL_
(
false
)
{
,
ssl_ctx_
(
nullptr
)
}
{
}
Listener
::~
Listener
()
{
Listener
::~
Listener
()
{
if
(
isBound
())
if
(
isBound
())
...
...
src/server/router.cc
View file @
ea393877
...
@@ -347,8 +347,8 @@ void
...
@@ -347,8 +347,8 @@ void
Router
::
initFromDescription
(
const
Rest
::
Description
&
desc
)
{
Router
::
initFromDescription
(
const
Rest
::
Description
&
desc
)
{
auto
paths
=
desc
.
rawPaths
();
auto
paths
=
desc
.
rawPaths
();
for
(
auto
it
=
paths
.
flatBegin
(),
end
=
paths
.
flatEnd
();
it
!=
end
;
++
it
)
{
for
(
auto
it
=
paths
.
flatBegin
(),
end
=
paths
.
flatEnd
();
it
!=
end
;
++
it
)
{
const
auto
&
paths
=
*
it
;
const
auto
&
paths
_
=
*
it
;
for
(
const
auto
&
path
:
paths
)
{
for
(
const
auto
&
path
:
paths
_
)
{
if
(
!
path
.
isBound
())
{
if
(
!
path
.
isBound
())
{
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
oss
<<
"Path '"
<<
path
.
value
<<
"' is not bound"
;
oss
<<
"Path '"
<<
path
.
value
<<
"' is not bound"
;
...
...
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