Mercurial > vim
comparison src/channel.c @ 8354:b151c3f9be72 v7.4.1469
commit https://github.com/vim/vim/commit/42bc6dde46f1b52476cc84ee89277f981b4116c4
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 2 20:48:47 2016 +0100
patch 7.4.1469
Problem: Channel test sometimes fails, especially on OS/X. (Kazunobu
Kuriyama)
Solution: Change the && into ||, call getsockopt() in more situations.
(Ozaki Kiichi)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 02 Mar 2016 21:00:04 +0100 |
parents | a0cff08e7aa3 |
children | e0d576743e4f |
comparison
equal
deleted
inserted
replaced
8353:4867b778aa40 | 8354:b151c3f9be72 |
---|---|
718 #else | 718 #else |
719 /* On Linux-like systems: See socket(7) for the behavior | 719 /* On Linux-like systems: See socket(7) for the behavior |
720 * After putting the socket in non-blocking mode, connect() will | 720 * After putting the socket in non-blocking mode, connect() will |
721 * return EINPROGRESS, select() will not wait (as if writing is | 721 * return EINPROGRESS, select() will not wait (as if writing is |
722 * possible), need to use getsockopt() to check if the socket is | 722 * possible), need to use getsockopt() to check if the socket is |
723 * actually connect. | 723 * actually able to connect. |
724 * We detect an failure to connect when both read and write fds | 724 * We detect an failure to connect when either read and write fds |
725 * are set. Use getsockopt() to find out what kind of failure. */ | 725 * are set. Use getsockopt() to find out what kind of failure. */ |
726 if (FD_ISSET(sd, &rfds) && FD_ISSET(sd, &wfds)) | 726 if (FD_ISSET(sd, &rfds) || FD_ISSET(sd, &wfds)) |
727 { | 727 { |
728 ret = getsockopt(sd, | 728 ret = getsockopt(sd, |
729 SOL_SOCKET, SO_ERROR, &so_error, &so_error_len); | 729 SOL_SOCKET, SO_ERROR, &so_error, &so_error_len); |
730 if (ret < 0 || (so_error != 0 | 730 if (ret < 0 || (so_error != 0 |
731 && so_error != EWOULDBLOCK | 731 && so_error != EWOULDBLOCK |
1557 /* Append to the buffer */ | 1557 /* Append to the buffer */ |
1558 ch_logn(channel, "appending line %d to buffer", (int)lnum + 1); | 1558 ch_logn(channel, "appending line %d to buffer", (int)lnum + 1); |
1559 | 1559 |
1560 curbuf = buffer; | 1560 curbuf = buffer; |
1561 u_sync(TRUE); | 1561 u_sync(TRUE); |
1562 u_save(lnum, lnum + 1); | 1562 /* ignore undo failure, undo is not very useful here */ |
1563 ignored = u_save(lnum, lnum + 1); | |
1563 | 1564 |
1564 if (msg == NULL) | 1565 if (msg == NULL) |
1565 /* JSON or JS mode: re-encode the message. */ | 1566 /* JSON or JS mode: re-encode the message. */ |
1566 msg = json_encode(listtv, ch_mode); | 1567 msg = json_encode(listtv, ch_mode); |
1567 if (msg != NULL) | 1568 if (msg != NULL) |