2016-02-28 19:58 GMT+09:00 Ozaki Kiichi <[email protected]>: > Hi. > > I report some concerns about channel_open(). > > 1) https://github.com/vim/vim/blob/0f526f5/src/channel.c#L684 (On OS X) > > When "FD_ISSET(sd, &rfds) && FD_ISSET(sd, &wfds)" is satisfied, "ret" is > 2, thus this if-block is never used. > But removing "ret == 0" (or replacing by "ret == 2"), when we try to > connect to local port which is not listening, we go into if-block and it > returns NULL. >
In the section "Non-blocking connect" of the OS X manual page tcp(4), the description about possible return values of select() is not clearly given for the case in question. So I did check the return value and made sure that select() returned 0 if it was called after connect() returned < 0 and set EINPROGRESS. Believe or not, that was why I included the condition ret == 0. As a result, "waittime" is ignored (unlike other *nix environment), so > Test_open_delay fails. > > 2) https://github.com/vim/vim/blob/0f526f5/src/channel.c#L686 > > Originally, according to the following, this behavior "encounter of errors > cause a socket to be both readable and writeable" is derived from 4.4BSD > implementations. > > Refs: Unix Networking Programming > > https://books.google.co.jp/books?id=ptSC4LpwGA0C&pg=PA449&lpg=PA449&dq=tcp+socket+writable+on+error&source=bl&ots=Kr5DRiimUu&sig=LPaFAJzjQUN4Cmhp-VCLsvVmApM&hl=en&sa=X&ei=EYLcUM3wO9HW0gGb44GABw&redir_esc=y#v=onepage&q=tcp%20socket%20writable%20on%20error&f=false > > (and this book mentions that TCP/IP illustrated vol.2 describes about such > behavior; but I forgot where it is, sorry..) > > It appears that other *nix environments behave in the same way. > > But not vice versa, so we need check socket error by getsockopt() when > socket is both readable and writeable after connect(). > > > patch: > > https://gist.github.com/ichizok/e68a5b850df8362a0dbb > > > Thank you. > - Ozaki Kiichi > > -- > -- > You received this message from the "vim_dev" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
