forked from premiere/premiere-libtorrent
use random() instead of rand()
This commit is contained in:
parent
5a23ca5855
commit
27db5e3f49
|
@ -760,7 +760,7 @@ namespace libtorrent
|
||||||
// in anonymous mode, every peer connection
|
// in anonymous mode, every peer connection
|
||||||
// has a unique peer-id
|
// has a unique peer-id
|
||||||
for (int i = 0; i < 20; ++i)
|
for (int i = 0; i < 20; ++i)
|
||||||
*ptr++ = rand();
|
*ptr++ = random();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
#include <libtorrent/io.hpp>
|
#include <libtorrent/io.hpp>
|
||||||
|
#include <libtorrent/random.hpp>
|
||||||
#include <libtorrent/invariant_check.hpp>
|
#include <libtorrent/invariant_check.hpp>
|
||||||
#include <libtorrent/kademlia/node_id.hpp> // for generate_random_id
|
#include <libtorrent/kademlia/node_id.hpp> // for generate_random_id
|
||||||
#include <libtorrent/kademlia/rpc_manager.hpp>
|
#include <libtorrent/kademlia/rpc_manager.hpp>
|
||||||
|
@ -463,7 +464,7 @@ bool rpc_manager::invoke(entry& e, udp::endpoint target_addr
|
||||||
std::string transaction_id;
|
std::string transaction_id;
|
||||||
transaction_id.resize(2);
|
transaction_id.resize(2);
|
||||||
char* out = &transaction_id[0];
|
char* out = &transaction_id[0];
|
||||||
int tid = rand() ^ (rand() << 5);
|
int tid = random() ^ (random() << 5);
|
||||||
io::write_uint16(tid, out);
|
io::write_uint16(tid, out);
|
||||||
e["t"] = transaction_id;
|
e["t"] = transaction_id;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue