return FAIL;
}
-/*
- * Return a unique ID to be used in a message.
- */
- int
-channel_get_id(void)
-{
- static int next_id = 1;
-
- return next_id++;
-}
-
/*
* Read from channel "channel" for as long as there is something to read.
* "part" is PART_SOCK, PART_OUT or PART_ERR.
return;
}
- id = channel_get_id();
+ id = ++channel->ch_last_msg_id;
text = json_encode_nr_expr(id, &argvars[1],
ch_mode == MODE_JS ? JSON_JS : 0);
if (text == NULL)
char_u *channel_peek(channel_T *channel, int part);
void channel_clear(channel_T *channel);
void channel_free_all(void);
-int channel_get_id(void);
void channel_read(channel_T *channel, int part, char *func);
char_u *channel_read_block(channel_T *channel, int part, int timeout);
-int channel_read_json_block(channel_T *channel, int part, int timeout, int id, typval_T **rettv);
+int channel_read_json_block(channel_T *channel, int part, int timeout_arg, int id, typval_T **rettv);
void common_channel_read(typval_T *argvars, typval_T *rettv, int raw);
channel_T *channel_fd2channel(sock_T fd, int *partp);
void channel_handle_events(void);
channel_T *ch_prev;
int ch_id; /* ID of the channel */
+ int ch_last_msg_id; /* ID of the last message */
chanpart_T ch_part[4]; /* info for socket, out, err and in */