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
da66820d
Unverified
Commit
da66820d
authored
Nov 03, 2018
by
Dennis Jenkins
Committed by
GitHub
Nov 03, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #342 from knowledge4igor/code_improvements_7
Several code improvements
parents
2f5f5193
f2c68494
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
13 deletions
+6
-13
src/client/client.cc
src/client/client.cc
+4
-7
src/common/transport.cc
src/common/transport.cc
+2
-6
No files found.
src/client/client.cc
View file @
da66820d
...
...
@@ -310,15 +310,12 @@ Transport::handleConnectionQueue() {
void
Transport
::
handleIncoming
(
const
std
::
shared_ptr
<
Connection
>&
connection
)
{
char
buffer
[
Const
::
MaxBuffer
];
memset
(
buffer
,
0
,
sizeof
buffer
);
char
buffer
[
Const
::
MaxBuffer
]
=
{
0
};
ssize_t
totalBytes
=
0
;
for
(;;)
{
ssize_t
bytes
;
bytes
=
recv
(
connection
->
fd
,
buffer
+
totalBytes
,
Const
::
MaxBuffer
-
totalBytes
,
0
);
for
(;;)
{
ssize_t
bytes
=
recv
(
connection
->
fd
,
buffer
+
totalBytes
,
Const
::
MaxBuffer
-
totalBytes
,
0
);
if
(
bytes
==
-
1
)
{
if
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
)
{
if
(
totalBytes
>
0
)
{
...
...
@@ -777,7 +774,7 @@ Client::options() {
void
Client
::
init
(
const
Client
::
Options
&
options
)
{
pool
.
init
(
options
.
maxConnectionsPerHost_
);
transport_
.
reset
(
new
Transport
);
transport_
=
std
::
make_shared
<
Transport
>
(
);
reactor_
->
init
(
Aio
::
AsyncContext
(
options
.
threads_
));
transportKey
=
reactor_
->
addHandler
(
transport_
);
reactor_
->
run
();
...
...
src/common/transport.cc
View file @
da66820d
...
...
@@ -119,17 +119,13 @@ Transport::disarmTimer(Fd fd) {
void
Transport
::
handleIncoming
(
const
std
::
shared_ptr
<
Peer
>&
peer
)
{
char
buffer
[
Const
::
MaxBuffer
];
memset
(
buffer
,
0
,
sizeof
buffer
);
char
buffer
[
Const
::
MaxBuffer
]
=
{
0
};
ssize_t
totalBytes
=
0
;
int
fd
=
peer
->
fd
();
for
(;;)
{
ssize_t
bytes
;
bytes
=
recv
(
fd
,
buffer
+
totalBytes
,
Const
::
MaxBuffer
-
totalBytes
,
0
);
ssize_t
bytes
=
recv
(
fd
,
buffer
+
totalBytes
,
Const
::
MaxBuffer
-
totalBytes
,
0
);
if
(
bytes
==
-
1
)
{
if
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
)
{
if
(
totalBytes
>
0
)
{
...
...
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