Mercurial > prosody-hg
comparison net/server_select.lua @ 6813:b1615fa62e59
net/server_select: addclient: Check for failure correctly; remove wrapconnection call on failure
| author | daurnimator <quae@daurnimator.com> |
|---|---|
| date | Wed, 18 Dec 2013 17:54:31 -0500 |
| parents | 7af63377a1cf |
| children | 936f969bf783 |
comparison
equal
deleted
inserted
replaced
| 6812:7af63377a1cf | 6813:b1615fa62e59 |
|---|---|
| 946 local client, err = luasocket.tcp( ) | 946 local client, err = luasocket.tcp( ) |
| 947 if err then | 947 if err then |
| 948 return nil, err | 948 return nil, err |
| 949 end | 949 end |
| 950 client:settimeout( 0 ) | 950 client:settimeout( 0 ) |
| 951 _, err = client:connect( address, port ) | 951 local ok, err = client:connect( address, port ) |
| 952 if err then -- try again | 952 if ok or err == "timeout" then |
| 953 return wrapclient( client, address, port, listeners, pattern, sslctx ) | 953 return wrapclient( client, address, port, listeners, pattern, sslctx ) |
| 954 else | 954 else |
| 955 return wrapconnection( nil, listeners, client, address, port, "clientport", pattern, sslctx ) | 955 return nil, err |
| 956 end | 956 end |
| 957 end | 957 end |
| 958 | 958 |
| 959 --// EXPERIMENTAL //-- | 959 --// EXPERIMENTAL //-- |
| 960 | 960 |
