diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-27 19:16:54 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-27 19:16:54 +0000 |
commit | c0d0953bd7ad56837cb679b11ce200b63c664a4a (patch) | |
tree | 78047ad510e9f30e517cbde72edb5a9d04459fec /libs/nixio/lua | |
parent | 6003886675069a36b0be692ea657d442b08e266e (diff) |
libs/nixio: make TLS support optional
Diffstat (limited to 'libs/nixio/lua')
-rw-r--r-- | libs/nixio/lua/nixio/util.lua | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/libs/nixio/lua/nixio/util.lua b/libs/nixio/lua/nixio/util.lua index 409004882..63d2f6214 100644 --- a/libs/nixio/lua/nixio/util.lua +++ b/libs/nixio/lua/nixio/util.lua @@ -237,30 +237,34 @@ function meta.copyz(self, fd, size) return self:copy(fd, size) end -function tls_socket.close(self) - return self.socket:close() -end +if tls_socket then + function tls_socket.close(self) + return self.socket:close() + end -function tls_socket.getsockname(self) - return self.socket:getsockname() -end + function tls_socket.getsockname(self) + return self.socket:getsockname() + end -function tls_socket.getpeername(self) - return self.socket:getpeername() -end + function tls_socket.getpeername(self) + return self.socket:getpeername() + end -function tls_socket.getsockopt(self, ...) - return self.socket:getsockopt(...) -end -tls_socket.getopt = tls_socket.getsockopt + function tls_socket.getsockopt(self, ...) + return self.socket:getsockopt(...) + end + tls_socket.getopt = tls_socket.getsockopt -function tls_socket.setsockopt(self, ...) - return self.socket:setsockopt(...) + function tls_socket.setsockopt(self, ...) + return self.socket:setsockopt(...) + end + tls_socket.setopt = tls_socket.setsockopt end -tls_socket.setopt = tls_socket.setsockopt for k, v in pairs(meta) do file[k] = v socket[k] = v - tls_socket[k] = v + if tls_socket then + tls_socket[k] = v + end end |