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
ab960df8
Commit
ab960df8
authored
Feb 26, 2013
by
abadc0de
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lua call stack cleanup
parent
08048bd5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
5 deletions
+0
-5
mongoose.c
mongoose.c
+0
-5
No files found.
mongoose.c
View file @
ab960df8
...
@@ -3934,14 +3934,12 @@ static int handle_lsp_request(struct mg_connection *, const char *,
...
@@ -3934,14 +3934,12 @@ static int handle_lsp_request(struct mg_connection *, const char *,
static
int
lsp_mg_error
(
lua_State
*
L
)
{
static
int
lsp_mg_error
(
lua_State
*
L
)
{
struct
mg_connection
*
conn
=
lua_touserdata
(
L
,
lua_upvalueindex
(
1
));
struct
mg_connection
*
conn
=
lua_touserdata
(
L
,
lua_upvalueindex
(
1
));
int
top
=
lua_gettop
(
L
);
int
top
=
lua_gettop
(
L
);
if
(
top
>
1
)
lua_settop
(
L
,
1
);
if
(
top
<
1
)
lua_pushstring
(
L
,
"unknown error"
);
if
(
top
<
1
)
lua_pushstring
(
L
,
"unknown error"
);
// Get mg.onerror.
// Get mg.onerror.
lua_getglobal
(
L
,
"mg"
);
lua_getglobal
(
L
,
"mg"
);
lua_getfield
(
L
,
-
1
,
"onerror"
);
lua_getfield
(
L
,
-
1
,
"onerror"
);
// If mg.onerror is nil, silently stop processing chunks.
// If mg.onerror is nil, silently stop processing chunks.
if
(
lua_isnil
(
L
,
-
1
))
{
if
(
lua_isnil
(
L
,
-
1
))
{
lua_settop
(
L
,
0
);
lua_pushinteger
(
L
,
1
);
lua_pushinteger
(
L
,
1
);
return
1
;
return
1
;
}
}
...
@@ -3951,13 +3949,10 @@ static int lsp_mg_error(lua_State *L) {
...
@@ -3951,13 +3949,10 @@ static int lsp_mg_error(lua_State *L) {
if
(
lua_pcall
(
L
,
1
,
1
,
0
))
{
if
(
lua_pcall
(
L
,
1
,
1
,
0
))
{
// If mg.onerror fails, cry the error message and stop processing chunks.
// If mg.onerror fails, cry the error message and stop processing chunks.
cry
(
conn
,
"mg.onerror failed: %s"
,
lua_tostring
(
L
,
-
1
));
cry
(
conn
,
"mg.onerror failed: %s"
,
lua_tostring
(
L
,
-
1
));
lua_settop
(
L
,
0
);
lua_pushinteger
(
L
,
1
);
lua_pushinteger
(
L
,
1
);
return
1
;
return
1
;
}
}
// Return the return value from mg.onerror. Non-0 = stop processing chunks.
// Return the return value from mg.onerror. Non-0 = stop processing chunks.
lua_replace
(
L
,
1
);
lua_settop
(
L
,
1
);
return
1
;
return
1
;
}
}
...
...
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