Software /
code /
prosody
Comparison
net/server_epoll.lua @ 9498:cc593002f2e2
net.server_epoll: Check return conditions of early socket setup
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 12 Oct 2018 17:28:08 +0200 |
parent | 9497:183ff7a8051b |
child | 9499:36e379f058c8 |
comparison
equal
deleted
inserted
replaced
9497:183ff7a8051b | 9498:cc593002f2e2 |
---|---|
641 end | 641 end |
642 if type(create) ~= "function" then | 642 if type(create) ~= "function" then |
643 return nil, "invalid socket type"; | 643 return nil, "invalid socket type"; |
644 end | 644 end |
645 local conn, err = create(); | 645 local conn, err = create(); |
646 conn:settimeout(0); | 646 local ok, err = conn:settimeout(0); |
647 conn:connect(addr, port); | 647 if not ok then return ok, err; end |
648 local ok, err = conn:connect(addr, port); | |
649 if not ok and err ~= "timeout" then return ok, err; end | |
648 local client = wrapsocket(conn, nil, read_size, listeners, tls_ctx) | 650 local client = wrapsocket(conn, nil, read_size, listeners, tls_ctx) |
649 local ok, err = client:init(); | 651 local ok, err = client:init(); |
650 if not ok then return ok, err; end | 652 if not ok then return ok, err; end |
651 if tls_ctx then | 653 if tls_ctx then |
652 client:starttls(tls_ctx); | 654 client:starttls(tls_ctx); |