Skip to content

Commit d06eba3

Browse files
committed
Use ipairs instead of i=1,#plain loop
1 parent c18f0c7 commit d06eba3

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

deps/secure-socket/biowrap.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ end
2525

2626
-- handshakeComplete is called when the handhake is complete and it's safe
2727
-- onPlain is called when plaintext comes out.
28-
-- buffer is the data that will be read before any data that the stream receives.
29-
return function (ctx, isServer, socket, handshakeComplete, servername, buffer)
28+
-- initialData is the data that will be read before any data that the stream receives.
29+
return function (ctx, isServer, socket, handshakeComplete, servername, initialData)
3030

3131
local bin, bout = openssl.bio.mem(8192), openssl.bio.mem(8192)
3232
local ssl = ctx:ssl(bin, bout, isServer)
@@ -111,7 +111,7 @@ return function (ctx, isServer, socket, handshakeComplete, servername, buffer)
111111
-- When requested to write plain data, encrypt it and write to socket
112112
function ssocket.write(_, plain, callback)
113113
if type(plain) == "table" then
114-
for i=1, #plain do
114+
for i in ipairs(plain) do
115115
ssl:write(plain[i])
116116
end
117117
else
@@ -143,8 +143,8 @@ return function (ctx, isServer, socket, handshakeComplete, servername, buffer)
143143
end
144144

145145
handshake()
146-
if buffer then
147-
onCipher(nil, buffer)
146+
if initialData then
147+
onCipher(nil, initialData)
148148
end
149149
socket:read_start(onCipher)
150150

deps/secure-socket/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ return function (socket, options, callback)
3434
end
3535
bioWrap(ctx, options.server, socket, callback or function (err, ssocket)
3636
return assertResume(thread, ssocket, err)
37-
end, options.servername, options.buffer)
37+
end, options.servername, options.initialData)
3838
if not callback then
3939
return coroutine.yield()
4040
end

0 commit comments

Comments
 (0)