diff options
author | etxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-11-09 06:01:18 +0000 |
---|---|---|
committer | etxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-11-09 06:01:18 +0000 |
commit | 52c22485f76e560bd64b369273b601b5bfa0f3b9 (patch) | |
tree | 874c9902e9d5e87aeda6b3c11e76dd35b41312f0 /epan/dissectors/packet-bittorrent.c | |
parent | 58b59b69930f7d89d1fec724f4de0832835175aa (diff) |
Apply yet another set of the optimization patches:
When offset parameter is 0 replace tvb_bytes_exist() with the faster tvb_length().
On the other hand
if (tvb_bytes_exist(tvb, 0, 20)
is more readable than
if (tvb_length(tvb) >= 20
so only do it in heuristic function
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23412 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-bittorrent.c')
-rw-r--r-- | epan/dissectors/packet-bittorrent.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/epan/dissectors/packet-bittorrent.c b/epan/dissectors/packet-bittorrent.c index 71215f3dd5..ec73e179e4 100644 --- a/epan/dissectors/packet-bittorrent.c +++ b/epan/dissectors/packet-bittorrent.c @@ -761,9 +761,10 @@ static gboolean test_bittorrent_packet (tvbuff_t *tvb, packet_info *pinfo, { conversation_t *conversation; - if (tvb_bytes_exist(tvb, 0, 20) && + if (tvb_length(tvb) >= 20 && tvb_get_guint8(tvb, 0) == 19 && tvb_memeql(tvb, 1, "BitTorrent protocol", 19) == 0) { + /* XXXX why new ? */ conversation = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); conversation_set_dissector(conversation, dissector_handle); |