{"action":"created","issue":{"url":"https://api.github.com/repos/diegonehab/luasocket/issues/99","labels_url":"https://api.github.com/repos/diegonehab/luasocket/issues/99/labels{/name}","comments_url":"https://api.github.com/repos/diegonehab/luasocket/issues/99/comments","events_url":"https://api.github.com/repos/diegonehab/luasocket/issues/99/events","html_url":"https://github.com/diegonehab/luasocket/issues/99","id":36676411,"number":99,"title":"non-blocking connects with multiple DNS entries return EALREADY","user":{"login":"daurnimator","id":127971,"avatar_url":"https://avatars.githubusercontent.com/u/127971?v=3","gravatar_id":"","url":"https://api.github.com/users/daurnimator","html_url":"https://github.com/daurnimator","followers_url":"https://api.github.com/users/daurnimator/followers","following_url":"https://api.github.com/users/daurnimator/following{/other_user}","gists_url":"https://api.github.com/users/daurnimator/gists{/gist_id}","starred_url":"https://api.github.com/users/daurnimator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daurnimator/subscriptions","organizations_url":"https://api.github.com/users/daurnimator/orgs","repos_url":"https://api.github.com/users/daurnimator/repos","events_url":"https://api.github.com/users/daurnimator/events{/privacy}","received_events_url":"https://api.github.com/users/daurnimator/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":37,"created_at":"2014-06-27T15:29:08Z","updated_at":"2015-03-07T19:41:25Z","closed_at":null,"body":"Non-blocking connects when theres multiple DNS entries keep iterating through entries after getting `EINPROGRESS` and end up returning `EALREADY` instead.\r\n\r\n```lua\r\ns=require\"socket\"\r\nprint(s._VERSION)\r\nm=s.tcp()\r\nm:settimeout(0)\r\nprint(m:connect(\"google.com\",80))\r\n```\r\n```\r\nLuaSocket 3.0-rc1\r\nnil     Operation already in progress\r\n```\r\nExpected `nil, timeout` instead."},"comment":{"url":"https://api.github.com/repos/diegonehab/luasocket/issues/comments/77706125","html_url":"https://github.com/diegonehab/luasocket/issues/99#issuecomment-77706125","issue_url":"https://api.github.com/repos/diegonehab/luasocket/issues/99","id":77706125,"user":{"login":"Tieske","id":1077043,"avatar_url":"https://avatars.githubusercontent.com/u/1077043?v=3","gravatar_id":"","url":"https://api.github.com/users/Tieske","html_url":"https://github.com/Tieske","followers_url":"https://api.github.com/users/Tieske/followers","following_url":"https://api.github.com/users/Tieske/following{/other_user}","gists_url":"https://api.github.com/users/Tieske/gists{/gist_id}","starred_url":"https://api.github.com/users/Tieske/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tieske/subscriptions","organizations_url":"https://api.github.com/users/Tieske/orgs","repos_url":"https://api.github.com/users/Tieske/repos","events_url":"https://api.github.com/users/Tieske/events{/privacy}","received_events_url":"https://api.github.com/users/Tieske/received_events","type":"User","site_admin":false},"created_at":"2015-03-07T19:41:25Z","updated_at":"2015-03-07T19:41:25Z","body":"Though I think my 2nd proposal (error out when resolving a name on a non-blocking socket) is the cleanest from an API perspective. It is also the most 'breaking'  option, so probably overall not the 'best' option.\r\n\r\nConsolidating; when connecting on a non-blocking socket;\r\n\r\n1. when proving an IP address; connect and do the regular INPROGRESS error messaging so the client can perform the connect async/non-blocking.\r\n2. when by name with a single target; resolve DNS (short block) and then do INPROGRESS as per nr. 1\r\n3. when by name with a multi-target; the same as nr. 2, connecting on the first address returned. But add the extra return value after the errormessage; a list of resolved IP addresses\r\n\r\nDoes that make sense?\r\n\r\nPS. anyone an answer to my \"what constitutes a non-blocking socket\" question?\r\n"}}