Comparison

net/server_epoll.lua @ 7596:2c4ba55b616c

net.server_epoll: Connect async in addclient
author Kim Alvefur <zash@zash.se>
date Thu, 18 Aug 2016 17:04:57 +0200
parent 7595:166b2e0766a4
child 7597:cd34aa6b1632
comparison
equal deleted inserted replaced
7595:166b2e0766a4 7596:2c4ba55b616c
527 client:setflags(false, true); 527 client:setflags(false, true);
528 return client; 528 return client;
529 end 529 end
530 530
531 local function addclient(addr, port, listeners, pattern, tls) 531 local function addclient(addr, port, listeners, pattern, tls)
532 local conn, err = socket.connect(addr, port); 532 local conn, err = socket.tcp();
533 if not conn then return conn, err; end 533 if not conn then return conn, err; end
534 conn:settimeout(0); 534 conn:settimeout(0);
535 conn:connect(addr, port);
535 local client = wrapclient(conn, addr, port, listeners, pattern, tls); 536 local client = wrapclient(conn, addr, port, listeners, pattern, tls);
536 if tls then 537 if tls then
537 client._tls = false; 538 client._tls = false;
538 client:starttls(); 539 client:starttls();
539 else 540 else