diff options
author | Anders Broman <anders.broman@ericsson.com> | 2007-11-09 06:01:18 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2007-11-09 06:01:18 +0000 |
commit | 622603589393ddd44656437f2e323c7fecf1c362 (patch) | |
tree | 874c9902e9d5e87aeda6b3c11e76dd35b41312f0 /epan/dissectors/packet-bittorrent.c | |
parent | 29cf34d1c2fa3d56559fd08cfa4bc5616f9cbf14 (diff) | |
download | wireshark-622603589393ddd44656437f2e323c7fecf1c362.tar.gz wireshark-622603589393ddd44656437f2e323c7fecf1c362.tar.bz2 wireshark-622603589393ddd44656437f2e323c7fecf1c362.zip |
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
svn path=/trunk/; revision=23412
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); |