summaryrefslogtreecommitdiff
path: root/src/channel.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-04-30 17:06:31 +0200
committerBram Moolenaar <Bram@vim.org>2016-04-30 17:06:31 +0200
commit715d285d79a1d97928dd717278e25e6de45d1496 (patch)
tree307457a0725a280b2d74ddfc0092a85452810091 /src/channel.c
parent868cfc19bb079a16ca58884b551486566f35419b (diff)
downloadvim-git-715d285d79a1d97928dd717278e25e6de45d1496.tar.gz
patch 7.4.1810v7.4.1810
Problem: Sending DETACH after a channel was closed isn't useful. Solution: Only add DETACH for a netbeans channel.
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/channel.c b/src/channel.c
index aa588031c..d8e55e7b2 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -2595,7 +2595,7 @@ channel_free_all(void)
#endif
-/* Sent when the channel is found closed when reading. */
+/* Sent when the netbeans channel is found closed when reading. */
#define DETACH_MSG_RAW "DETACH\n"
/* Buffer size for reading incoming messages. */
@@ -2766,7 +2766,7 @@ channel_wait(channel_T *channel, sock_T fd, int timeout)
}
static void
-channel_close_on_error(channel_T *channel, int part, char *func)
+channel_close_on_error(channel_T *channel, char *func)
{
/* Do not call emsg(), most likely the other end just exited. */
ch_errors(channel, "%s(): Cannot read from channel", func);
@@ -2780,10 +2780,9 @@ channel_close_on_error(channel_T *channel, int part, char *func)
* -> ui_breakcheck
* -> gui event loop or select loop
* -> channel_read()
- * Don't send "DETACH" for a JS or JSON channel.
+ * Only send "DETACH" for a netbeans channel.
*/
- if (channel->ch_part[part].ch_mode == MODE_RAW
- || channel->ch_part[part].ch_mode == MODE_NL)
+ if (channel->ch_nb_close_cb != NULL)
channel_save(channel, PART_OUT, (char_u *)DETACH_MSG_RAW,
(int)STRLEN(DETACH_MSG_RAW), FALSE, "PUT ");
@@ -2847,7 +2846,7 @@ channel_read(channel_T *channel, int part, char *func)
/* Reading a disconnection (readlen == 0), or an error. */
if (readlen <= 0)
- channel_close_on_error(channel, part, func);
+ channel_close_on_error(channel, func);
#if defined(CH_HAS_GUI) && defined(FEAT_GUI_GTK)
/* signal the main loop that there is something to read */
@@ -3119,8 +3118,7 @@ channel_handle_events(void)
if (r == CW_READY)
channel_read(channel, part, "channel_handle_events");
else if (r == CW_ERROR)
- channel_close_on_error(channel, part,
- "channel_handle_events()");
+ channel_close_on_error(channel, "channel_handle_events()");
}
}
}