diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-02-09 01:51:42 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-02-09 01:51:42 +0900 |
| commit | 9b7e4219d97b546ab9076d2b0e33fb0d5e8ff0a4 (patch) | |
| tree | dc13949606f106b133cc349e5e750c0c738512c6 /src/BtBitfieldMessage.cc | |
| parent | 7489bbe1a7b8a497a8f59dc565882d3e97d82cb5 (diff) | |
Reserve PeerConnection's buffer capacity according to number of pieces.
If the number of pieces gets bigger, the length of Bitfield message
payload exceeds the initial buffer capacity of PeerConnection, which
is MAX_PAYLOAD_LEN. We expand buffer as necessary so that
PeerConnection can receive the Bitfield message.
Diffstat (limited to 'src/BtBitfieldMessage.cc')
| -rw-r--r-- | src/BtBitfieldMessage.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/BtBitfieldMessage.cc b/src/BtBitfieldMessage.cc index 6992d281..6ba1d97e 100644 --- a/src/BtBitfieldMessage.cc +++ b/src/BtBitfieldMessage.cc @@ -104,8 +104,8 @@ unsigned char* BtBitfieldMessage::createMessage() { /** * len --- 1+bitfieldLength, 4bytes * id --- 5, 1byte - * bitfield --- bitfield, len bytes - * total: 5+len bytes + * bitfield --- bitfield, bitfieldLength bytes + * total: 5+bitfieldLength bytes */ const size_t msgLength = 5+bitfieldLength_; unsigned char* msg = new unsigned char[msgLength]; |
