Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
68437de4
Commit
68437de4
authored
Jul 12, 2016
by
Deomid Ryabkov
Committed by
Cesanta Bot
Jul 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of socket write errors
PUBLISHED_FROM=7264edfb3b8e4e37f15f2993f479dfe0a9550b1d
parent
459cd1b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
mongoose.c
mongoose.c
+12
-8
No files found.
mongoose.c
View file @
68437de4
...
@@ -2803,9 +2803,10 @@ static void mg_write_to_socket(struct mg_connection *nc) {
...
@@ -2803,9 +2803,10 @@ static void mg_write_to_socket(struct mg_connection *nc) {
DBG
((
"%p %d bytes -> %d (SSL)"
,
nc
,
n
,
nc
->
sock
));
DBG
((
"%p %d bytes -> %d (SSL)"
,
nc
,
n
,
nc
->
sock
));
if
(
n
<=
0
)
{
if
(
n
<=
0
)
{
int
ssl_err
=
mg_ssl_err
(
nc
,
n
);
int
ssl_err
=
mg_ssl_err
(
nc
,
n
);
if
(
ssl_err
==
SSL_ERROR_WANT_READ
||
ssl_err
=
=
SSL_ERROR_WANT_WRITE
)
{
if
(
ssl_err
!=
SSL_ERROR_WANT_READ
&&
ssl_err
!
=
SSL_ERROR_WANT_WRITE
)
{
return
;
/* Call us again */
nc
->
flags
|=
MG_F_CLOSE_IMMEDIATELY
;
}
}
return
;
}
else
{
}
else
{
/* Successful SSL operation, clear off SSL wait flags */
/* Successful SSL operation, clear off SSL wait flags */
nc
->
flags
&=
~
(
MG_F_WANT_READ
|
MG_F_WANT_WRITE
);
nc
->
flags
&=
~
(
MG_F_WANT_READ
|
MG_F_WANT_WRITE
);
...
@@ -2819,7 +2820,11 @@ static void mg_write_to_socket(struct mg_connection *nc) {
...
@@ -2819,7 +2820,11 @@ static void mg_write_to_socket(struct mg_connection *nc) {
{
{
n
=
(
int
)
MG_SEND_FUNC
(
nc
->
sock
,
io
->
buf
,
io
->
len
,
0
);
n
=
(
int
)
MG_SEND_FUNC
(
nc
->
sock
,
io
->
buf
,
io
->
len
,
0
);
DBG
((
"%p %d bytes -> %d"
,
nc
,
n
,
nc
->
sock
));
DBG
((
"%p %d bytes -> %d"
,
nc
,
n
,
nc
->
sock
));
if
(
n
<
0
&&
!
mg_is_error
(
n
))
return
;
if
(
n
<
0
&&
mg_is_error
(
n
))
{
/* Something went wrong, drop the connection. */
nc
->
flags
|=
MG_F_CLOSE_IMMEDIATELY
;
return
;
}
}
}
if
(
n
>
0
)
{
if
(
n
>
0
)
{
...
@@ -10607,22 +10612,21 @@ static void mg_write_to_socket(struct mg_connection *nc) {
...
@@ -10607,22 +10612,21 @@ static void mg_write_to_socket(struct mg_connection *nc) {
int
n
=
0
;
int
n
=
0
;
if
(
nc
->
flags
&
MG_F_UDP
)
{
if
(
nc
->
flags
&
MG_F_UDP
)
{
int
n
=
sl_SendTo
(
nc
->
sock
,
io
->
buf
,
io
->
len
,
0
,
&
nc
->
sa
.
sa
,
n
=
sl_SendTo
(
nc
->
sock
,
io
->
buf
,
io
->
len
,
0
,
&
nc
->
sa
.
sa
,
sizeof
(
nc
->
sa
.
sin
));
sizeof
(
nc
->
sa
.
sin
));
DBG
((
"%p %d %d %d %s:%hu"
,
nc
,
nc
->
sock
,
n
,
errno
,
DBG
((
"%p %d %d %d %s:%hu"
,
nc
,
nc
->
sock
,
n
,
errno
,
inet_ntoa
(
nc
->
sa
.
sin
.
sin_addr
),
ntohs
(
nc
->
sa
.
sin
.
sin_port
)));
inet_ntoa
(
nc
->
sa
.
sin
.
sin_addr
),
ntohs
(
nc
->
sa
.
sin
.
sin_port
)));
if
(
n
>
0
)
mbuf_remove
(
io
,
n
);
mg_if_sent_cb
(
nc
,
n
);
return
;
}
else
{
}
else
{
n
=
(
int
)
sl_Send
(
nc
->
sock
,
io
->
buf
,
io
->
len
,
0
);
n
=
(
int
)
sl_Send
(
nc
->
sock
,
io
->
buf
,
io
->
len
,
0
);
DBG
((
"%p %d bytes -> %d"
,
nc
,
n
,
nc
->
sock
));
DBG
((
"%p %d bytes -> %d"
,
nc
,
n
,
nc
->
sock
));
if
(
n
<
0
&&
!
mg_is_error
(
n
))
return
;
}
}
if
(
n
>
0
)
{
if
(
n
>
0
)
{
mbuf_remove
(
io
,
n
);
mbuf_remove
(
io
,
n
);
mg_if_sent_cb
(
nc
,
n
);
mg_if_sent_cb
(
nc
,
n
);
}
else
if
(
n
<
0
&&
mg_is_error
(
n
))
{
/* Something went wrong, drop the connection. */
nc
->
flags
|=
MG_F_CLOSE_IMMEDIATELY
;
}
}
}
}
...
...
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