| 1 |
// Package sideband implements a sideband multiplex/demultiplexer |
| 2 |
package sideband |
| 3 |
|
| 4 |
// If 'side-band' or 'side-band-64k' capabilities have been specified by |
| 5 |
// the client, the server will send the packfile data multiplexed. |
| 6 |
// |
| 7 |
// Either mode indicates that the packfile data will be streamed broken |
| 8 |
// up into packets of up to either 1000 bytes in the case of 'side_band', |
| 9 |
// or 65520 bytes in the case of 'side_band_64k'. Each packet is made up |
| 10 |
// of a leading 4-byte pkt-line length of how much data is in the packet, |
| 11 |
// followed by a 1-byte stream code, followed by the actual data. |
| 12 |
// |
| 13 |
// The stream code can be one of: |
| 14 |
// |
| 15 |
// 1 - pack data |
| 16 |
// 2 - progress messages |
| 17 |
// 3 - fatal error message just before stream aborts |
| 18 |
// |
| 19 |
// The "side-band-64k" capability came about as a way for newer clients |
| 20 |
// that can handle much larger packets to request packets that are |
| 21 |
// actually crammed nearly full, while maintaining backward compatibility |
| 22 |
// for the older clients. |
| 23 |
// |
| 24 |
// Further, with side-band and its up to 1000-byte messages, it's actually |
| 25 |
// 999 bytes of payload and 1 byte for the stream code. With side-band-64k, |
| 26 |
// same deal, you have up to 65519 bytes of data and 1 byte for the stream |
| 27 |
// code. |
| 28 |
// |
| 29 |
// The client MUST send only maximum of one of "side-band" and "side- |
| 30 |
// band-64k". Server MUST diagnose it as an error if client requests |
| 31 |
// both. |