You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionSSLSocket:write(msg,cb)
-- here we have to make closure for each call -- (or use table to cache them with `cb` as key)self._sock:write(msg, function(_, ...) cb(self, ...) end)
end
I suggest allow pass additional context argument to write function
functionSSLSocket:__init()
self._on_write_done=function(_, err, cb) cb(self, err) endendfunctionSSLSocket:write(msg,cb)
-- here we can use same closure for all callsself._sock:write(msg, self._on_write_done, cb)
end
Add context to other callbacks I see no reason because they do not call as often as write.
But this adds some inconsistent to API. Also I do not think it possible make multiple variables as context because for this we need some table and user code can do this by self.
The text was updated successfully, but these errors were encountered:
This may be helpful to implement wrapper classes
E.g. SSL socket
I suggest allow pass additional context argument to write function
Add context to other callbacks I see no reason because they do not call as often as write.
But this adds some inconsistent to API. Also I do not think it possible make multiple variables as context because for this we need some table and user code can do this by self.
The text was updated successfully, but these errors were encountered: