Skip to content

Improve logging and cleanup when ConnectionThread failes#91

Merged
marcoskirsch merged 4 commits intomarcoskirsch:masterfrom
HHHartmann:BetterLoggingAndMoreCloseConnections
Jun 1, 2017
Merged

Improve logging and cleanup when ConnectionThread failes#91
marcoskirsch merged 4 commits intomarcoskirsch:masterfrom
HHHartmann:BetterLoggingAndMoreCloseConnections

Conversation

@HHHartmann
Copy link
Contributor

When the connection Thread fials (status error)
the thread and the connection are cleaned up properly.

close connection on coroutine errors and improve logging around closieg
connections.
Release memory warlier
httpserver.lua Outdated
fileServeFunction(bufferedConnection, req, args)
-- The bufferedConnection may still hold some data that hasn't been sent. Flush it before closing.
if not bufferedConnection:flush() then
log(connection, "closing connetion", "no (more) data")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: connetion

httpserver.lua Outdated
if not status then log(connection:getpeer(), "Error: " .. err) end
if not status then
log(connection, "Error: "..err)
log(connection, "closing connetion", "error")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: connetion

httpserver.lua Outdated
end

local function onDisconnect(connection, payload)
print("disconnected")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no big deal but maybe leave this commented out

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm this is only printed if the client disconnects, so to get the bracket open / close I like it.
But I can still take it out

@HHHartmann
Copy link
Contributor Author

There you go :-)

@marcoskirsch marcoskirsch merged commit a09b4b4 into marcoskirsch:master Jun 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants