diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-02-05 14:26:11 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-02-05 14:26:11 -0800 |
commit | 5f8b86db94e789bc07258f98cc5ba25d18273d83 (patch) | |
tree | e4f8a21992261176c7ac61a90ac437bd7e4035af /sideband.h | |
parent | Merge branch 'sg/obstack-cast-function-type-fix' (diff) | |
parent | tests: define GIT_TEST_SIDEBAND_ALL (diff) | |
download | tgif-5f8b86db94e789bc07258f98cc5ba25d18273d83.tar.xz |
Merge branch 'jt/fetch-v2-sideband'
"git fetch" and "git upload-pack" learned to send all exchange over
the sideband channel while talking the v2 protocol.
* jt/fetch-v2-sideband:
tests: define GIT_TEST_SIDEBAND_ALL
{fetch,upload}-pack: sideband v2 fetch response
sideband: reverse its dependency on pkt-line
pkt-line: introduce struct packet_writer
pack-protocol.txt: accept error packets in any context
Use packet_reader instead of packet_read_line
Diffstat (limited to 'sideband.h')
-rw-r--r-- | sideband.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sideband.h b/sideband.h index 7a8146f161..227740a58e 100644 --- a/sideband.h +++ b/sideband.h @@ -1,10 +1,29 @@ #ifndef SIDEBAND_H #define SIDEBAND_H -#define SIDEBAND_PROTOCOL_ERROR -2 -#define SIDEBAND_REMOTE_ERROR -1 +enum sideband_type { + SIDEBAND_PROTOCOL_ERROR = -2, + SIDEBAND_REMOTE_ERROR = -1, + SIDEBAND_FLUSH = 0, + SIDEBAND_PRIMARY = 1 +}; + +/* + * Inspects a multiplexed packet read from the remote. If this packet is a + * progress packet and thus should not be processed by the caller, returns 0. + * Otherwise, returns 1, releases scratch, and sets sideband_type. + * + * If this packet is SIDEBAND_PROTOCOL_ERROR, SIDEBAND_REMOTE_ERROR, or a + * progress packet, also prints a message to stderr. + * + * scratch must be a struct strbuf allocated by the caller. It is used to store + * progress messages split across multiple packets. + */ +int demultiplex_sideband(const char *me, char *buf, int len, + int die_on_error, + struct strbuf *scratch, + enum sideband_type *sideband_type); -int recv_sideband(const char *me, int in_stream, int out); void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max); #endif |