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
5a02c9db
Commit
5a02c9db
authored
8 years ago
by
Alexander Alashkin
Committed by
rojer
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix create and close conn for UDP. Closes cesanta/dev#3162
PUBLISHED_FROM=071fb54d90750143751c1badc52757f0ba90bdb5
parent
2c4ffcf7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
mongoose.c
mongoose.c
+18
-8
No files found.
mongoose.c
View file @
5a02c9db
...
...
@@ -2328,7 +2328,7 @@ int mg_resolve(const char *host, char *buf, size_t n) {
}
#endif
/* MG_DISABLE_SYNC_RESOLVER */
MG_INTERNAL
struct
mg_connection
*
mg_create_connection
(
MG_INTERNAL
struct
mg_connection
*
mg_create_connection
_base
(
struct
mg_mgr
*
mgr
,
mg_event_handler_t
callback
,
struct
mg_add_sock_opts
opts
)
{
struct
mg_connection
*
conn
;
...
...
@@ -2346,13 +2346,22 @@ MG_INTERNAL struct mg_connection *mg_create_connection(
* doesn't compile with pedantic ansi flags.
*/
conn
->
recv_mbuf_limit
=
~
0
;
if
(
!
mg_if_create_conn
(
conn
))
{
MG_FREE
(
conn
);
conn
=
NULL
;
MG_SET_PTRPTR
(
opts
.
error_string
,
"failed init connection"
);
}
}
else
{
MG_SET_PTRPTR
(
opts
.
error_string
,
"failed create connection"
);
MG_SET_PTRPTR
(
opts
.
error_string
,
"failed to create connection"
);
}
return
conn
;
}
MG_INTERNAL
struct
mg_connection
*
mg_create_connection
(
struct
mg_mgr
*
mgr
,
mg_event_handler_t
callback
,
struct
mg_add_sock_opts
opts
)
{
struct
mg_connection
*
conn
=
mg_create_connection_base
(
mgr
,
callback
,
opts
);
if
(
!
mg_if_create_conn
(
conn
))
{
MG_FREE
(
conn
);
conn
=
NULL
;
MG_SET_PTRPTR
(
opts
.
error_string
,
"failed to init connection"
);
}
return
conn
;
...
...
@@ -2694,7 +2703,8 @@ void mg_if_recv_udp_cb(struct mg_connection *nc, void *buf, int len,
if
(
nc
==
NULL
)
{
struct
mg_add_sock_opts
opts
;
memset
(
&
opts
,
0
,
sizeof
(
opts
));
nc
=
mg_create_connection
(
lc
->
mgr
,
lc
->
handler
,
opts
);
/* Create fake connection w/out sock initialization */
nc
=
mg_create_connection_base
(
lc
->
mgr
,
lc
->
handler
,
opts
);
if
(
nc
!=
NULL
)
{
nc
->
sock
=
lc
->
sock
;
nc
->
listener
=
lc
;
...
...
This diff is collapsed.
Click to expand it.
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