Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some small code cleanups #172

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/lib/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -2381,6 +2381,13 @@ static int bio_read(BIO *bio, char *dst, int lim) {
memcpy(dst, so->bio.ahead.p, count);
so->bio.ahead.p += count;

if (so->bio.ahead.p == so->bio.ahead.pe) {
free(so->bio.ahead.data);
so->bio.ahead.data = NULL;
so->bio.ahead.p = NULL;
so->bio.ahead.pe = NULL;
}

return count;
}

Expand Down
13 changes: 2 additions & 11 deletions src/socket.lua
Original file line number Diff line number Diff line change
Expand Up @@ -312,19 +312,10 @@ end)
--
-- Smarter socket:checktls
--
local havessl, whynossl

local _checktls; _checktls = socket.interpose("checktls", function(self)
local havessl, whynossl = pcall(require, "openssl.ssl")
if not havessl then
if havessl == false then
return nil, whynossl
end

local havessl, whynossl = pcall(require, "openssl.ssl")

if not havessl then
return nil, whynossl
end
return nil, whynossl
end

return _checktls(self)
Expand Down