Comparison

net/server_epoll.lua @ 7737:f93b3083b46b

net.server_epoll: Use _SOCKETINVALID from LuaSocket
author Kim Alvefur <zash@zash.se>
date Wed, 23 Nov 2016 17:27:44 +0100
parent 7707:7bb1cc7278b6
child 7794:424bbbeb9257
comparison
equal deleted inserted replaced
7735:1502ec4f3cbe 7737:f93b3083b46b
19 local epoll = require "epoll"; 19 local epoll = require "epoll";
20 local socket = require "socket"; 20 local socket = require "socket";
21 local luasec = require "ssl"; 21 local luasec = require "ssl";
22 local gettime = require "util.time".now; 22 local gettime = require "util.time".now;
23 local createtable = require "util.table".create; 23 local createtable = require "util.table".create;
24 local _SOCKETINVALID = socket._SOCKETINVALID or -1;
24 25
25 assert(socket.tcp6 and socket.tcp4, "Incompatible LuaSocket version"); 26 assert(socket.tcp6 and socket.tcp4, "Incompatible LuaSocket version");
26 27
27 local _ENV = nil; 28 local _ENV = nil;
28 29
155 -- Return the file descriptor number 156 -- Return the file descriptor number
156 function interface:getfd() 157 function interface:getfd()
157 if self.conn then 158 if self.conn then
158 return self.conn:getfd(); 159 return self.conn:getfd();
159 end 160 end
160 return -1; 161 return _SOCKETINVALID;
161 end 162 end
162 163
163 -- Get IP address 164 -- Get IP address
164 function interface:ip() 165 function interface:ip()
165 return self.peername or self.sockname; 166 return self.peername or self.sockname;