Cleaning up getline function

This commit is contained in:
Joshua Simmons 2010-07-21 01:12:31 +10:00
parent d3c6ab849b
commit ca767c8b42
1 changed files with 3 additions and 5 deletions

View File

@ -149,15 +149,13 @@ end
local function getline(self, errlevel)
local line, err = self.socket:receive("*l")
if line then
return line
end
if err ~= "timeout" and err ~= "wantread" then
if not line and err ~= "timeout" and err ~= "wantread" then
self:invoke("OnDisconnect", err, true)
self:shutdown()
error(err, errlevel)
end
return line
end
function meta:think()