remove "using luasocket" message

This commit is contained in:
Daniel Barlow 2023-02-15 20:06:58 +00:00
parent a258456f25
commit 118f78f334

View file

@ -39,6 +39,8 @@ local ERR_WHO = 7
--rfc2349 specifies the timeout and tsize extensions --rfc2349 specifies the timeout and tsize extensions
local SUPPORTED_OPTIONS = {blksize=true, timeout=true, tsize=true} local SUPPORTED_OPTIONS = {blksize=true, timeout=true, tsize=true}
local luasocket = require("socket")
--Use penlight's prettyprinter if available --Use penlight's prettyprinter if available
pcall(require, 'pl') pcall(require, 'pl')
local log = pretty and pretty.dump or print local log = pretty and pretty.dump or print
@ -70,7 +72,6 @@ local poll = (function()
} }
]] ]]
local luasocket = require("socket")
return function(fds, timeout) return function(fds, timeout)
local wantread = {} local wantread = {}
local wantwrite = {} local wantwrite = {}
@ -102,25 +103,22 @@ local function UDPSocket()
complete UDP socket implementation. complete UDP socket implementation.
see http://w3.impa.br/~diego/software/luasocket/udp.html for the luasocket UDP API see http://w3.impa.br/~diego/software/luasocket/udp.html for the luasocket UDP API
]] ]]
local okay, luasocket = pcall(require, "socket")
if okay then return {
log("using luasocket") fd = luasocket.udp(),
return { bind = function(self, address, port)
fd = luasocket.udp(), return self.fd:setsockname(address, port)
bind = function(self, address, port) end,
return self.fd:setsockname(address, port) sendto = function(self, data, address, port)
end, return self.fd:sendto(data, address, port)
sendto = function(self, data, address, port) end,
return self.fd:sendto(data, address, port) recvfrom = function(self, length)
end, return self.fd:receivefrom(length)
recvfrom = function(self, length) end,
return self.fd:receivefrom(length) close = function(self)
end, return self.fd:close()
close = function(self) end
return self.fd:close() }
end,
}
end
end end
local function is_netascii(s) local function is_netascii(s)