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
441eaa7f
Commit
441eaa7f
authored
Jun 15, 2016
by
rojer
Committed by
Sergey Lyubka
Jun 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle errors better in listening code for CC3200
PUBLISHED_FROM=9d4ab680fa672690735b827f56e135330f72beed
parent
632153a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
mongoose.c
mongoose.c
+7
-8
No files found.
mongoose.c
View file @
441eaa7f
...
...
@@ -11208,9 +11208,7 @@ int mg_if_listen_tcp(struct mg_connection *nc, union socket_address *sa) {
int
proto
=
0
;
if
(
nc
->
flags
&
MG_F_SSL
)
proto
=
SL_SEC_SOCKET
;
sock_t
sock
=
mg_open_listening_socket
(
sa
,
SOCK_STREAM
,
proto
);
if
(
sock
==
INVALID_SOCKET
)
{
return
(
errno
?
errno
:
1
);
}
if
(
sock
<
0
)
return
sock
;
mg_sock_set
(
nc
,
sock
);
#ifdef MG_ENABLE_SSL
return
sl_set_ssl_opts
(
nc
);
...
...
@@ -11286,17 +11284,18 @@ static int mg_accept_conn(struct mg_connection *lc) {
/* 'sa' must be an initialized address to bind to */
static
sock_t
mg_open_listening_socket
(
union
socket_address
*
sa
,
int
type
,
int
proto
)
{
int
r
;
socklen_t
sa_len
=
(
sa
->
sa
.
sa_family
==
AF_INET
)
?
sizeof
(
sa
->
sin
)
:
sizeof
(
sa
->
sin6
);
sock_t
sock
=
sl_Socket
(
sa
->
sa
.
sa_family
,
type
,
proto
);
if
(
sock
<
0
)
return
INVALID_SOCKET
;
if
(
bind
(
sock
,
&
sa
->
sa
,
sa_len
)
<
0
)
{
if
(
sock
<
0
)
return
sock
;
if
(
(
r
=
bind
(
sock
,
&
sa
->
sa
,
sa_len
)
)
<
0
)
{
sl_Close
(
sock
);
return
INVALID_SOCKET
;
return
r
;
}
if
(
type
!=
SOCK_DGRAM
&&
sl_Listen
(
sock
,
SOMAXCONN
)
<
0
)
{
if
(
type
!=
SOCK_DGRAM
&&
(
r
=
sl_Listen
(
sock
,
SOMAXCONN
)
)
<
0
)
{
sl_Close
(
sock
);
return
INVALID_SOCKET
;
return
r
;
}
mg_set_non_blocking_mode
(
sock
);
return
sock
;
...
...
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