equal
deleted
inserted
replaced
25 local inet = require "util.net"; |
25 local inet = require "util.net"; |
26 local inet_pton = inet.pton; |
26 local inet_pton = inet.pton; |
27 local _SOCKETINVALID = socket._SOCKETINVALID or -1; |
27 local _SOCKETINVALID = socket._SOCKETINVALID or -1; |
28 local new_id = require "util.id".short; |
28 local new_id = require "util.id".short; |
29 local xpcall = require "util.xpcall".xpcall; |
29 local xpcall = require "util.xpcall".xpcall; |
|
30 local sslconfig = require "util.sslconfig"; |
|
31 local tls_impl = require "net.tls_luasec"; |
30 |
32 |
31 local poller = require "util.poll" |
33 local poller = require "util.poll" |
32 local EEXIST = poller.EEXIST; |
34 local EEXIST = poller.EEXIST; |
33 local ENOENT = poller.ENOENT; |
35 local ENOENT = poller.ENOENT; |
34 |
36 |
1102 link = link; |
1104 link = link; |
1103 set_config = function (newconfig) |
1105 set_config = function (newconfig) |
1104 cfg = setmetatable(newconfig, default_config); |
1106 cfg = setmetatable(newconfig, default_config); |
1105 end; |
1107 end; |
1106 |
1108 |
|
1109 tls_builder = function(basedir) |
|
1110 return sslconfig._new(tls_impl.new_context, basedir) |
|
1111 end, |
|
1112 |
1107 -- libevent emulation |
1113 -- libevent emulation |
1108 event = { EV_READ = "r", EV_WRITE = "w", EV_READWRITE = "rw", EV_LEAVE = -1 }; |
1114 event = { EV_READ = "r", EV_WRITE = "w", EV_READWRITE = "rw", EV_LEAVE = -1 }; |
1109 addevent = function (fd, mode, callback) |
1115 addevent = function (fd, mode, callback) |
1110 log("warn", "Using deprecated libevent emulation, please update code to use watchfd API instead"); |
1116 log("warn", "Using deprecated libevent emulation, please update code to use watchfd API instead"); |
1111 local function onevent(self) |
1117 local function onevent(self) |