@@ -2595,7 +2595,7 @@ channel_free_all(void)
25952595#endif
25962596
25972597
2598- /* Sent when the channel is found closed when reading. */
2598+ /* Sent when the netbeans channel is found closed when reading. */
25992599#define DETACH_MSG_RAW "DETACH\n"
26002600
26012601/* Buffer size for reading incoming messages. */
@@ -2766,7 +2766,7 @@ channel_wait(channel_T *channel, sock_T fd, int timeout)
27662766}
27672767
27682768 static void
2769- channel_close_on_error (channel_T * channel , int part , char * func )
2769+ channel_close_on_error (channel_T * channel , char * func )
27702770{
27712771 /* Do not call emsg(), most likely the other end just exited. */
27722772 ch_errors (channel , "%s(): Cannot read from channel" , func );
@@ -2780,10 +2780,9 @@ channel_close_on_error(channel_T *channel, int part, char *func)
27802780 * -> ui_breakcheck
27812781 * -> gui event loop or select loop
27822782 * -> channel_read()
2783- * Don't send "DETACH" for a JS or JSON channel.
2783+ * Only send "DETACH" for a netbeans channel.
27842784 */
2785- if (channel -> ch_part [part ].ch_mode == MODE_RAW
2786- || channel -> ch_part [part ].ch_mode == MODE_NL )
2785+ if (channel -> ch_nb_close_cb != NULL )
27872786 channel_save (channel , PART_OUT , (char_u * )DETACH_MSG_RAW ,
27882787 (int )STRLEN (DETACH_MSG_RAW ), FALSE, "PUT " );
27892788
@@ -2847,7 +2846,7 @@ channel_read(channel_T *channel, int part, char *func)
28472846
28482847 /* Reading a disconnection (readlen == 0), or an error. */
28492848 if (readlen <= 0 )
2850- channel_close_on_error (channel , part , func );
2849+ channel_close_on_error (channel , func );
28512850
28522851#if defined(CH_HAS_GUI ) && defined(FEAT_GUI_GTK )
28532852 /* signal the main loop that there is something to read */
@@ -3119,8 +3118,7 @@ channel_handle_events(void)
31193118 if (r == CW_READY )
31203119 channel_read (channel , part , "channel_handle_events" );
31213120 else if (r == CW_ERROR )
3122- channel_close_on_error (channel , part ,
3123- "channel_handle_events()" );
3121+ channel_close_on_error (channel , "channel_handle_events()" );
31243122 }
31253123 }
31263124 }
0 commit comments