Closed (fixed)
Project:
BitTorrent
Version:
5.x-2.0-beta2
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Jan 2008 at 10:29 UTC
Updated:
18 Feb 2008 at 22:22 UTC
For MySQL before 5.0.2, the priority of NOT is very high. For example, "SELECT NOT 1 = 2" returns 0, since this means "SELECT (NOT 1) = 2", while "SELECT NOT (1 = 2)" returns 1.
From announce.php:
$result = db_query("SELECT btau.peer_id, btau.ip, btau.port FROM {bt_tracker_active_users} btau WHERE btau.info_hash = %b AND NOT btau.peer_id = %b LIMIT %d", $request['info_hash'], $request['peer_id'], $request['numwant']);
For some versions of MYSQL, this means that the negation of btau.peer_id must be equal to the id of the client trying to find peers, which is not likely to hold. It should be changed to:
$result = db_query("SELECT btau.peer_id, btau.ip, btau.port FROM {bt_tracker_active_users} btau WHERE btau.info_hash = %b AND NOT (btau.peer_id = %b) LIMIT %d", $request['info_hash'], $request['peer_id'], $request['numwant']);
which means that it should not be the case that the peer id is equal to the id of the client trying to find peers.
Comments
Comment #1
bradfordcp commentedThanks for all the bug reports / patches, I will make these changes and push out another version this weekend.
Comment #2
bradfordcp commentedThe change has been made check out beta 3 :)
Comment #3
bradfordcp commentedComment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.