Browse Source

Seed rand only at one place.

adaptive-webui-19844
sledgehammer999 12 years ago
parent
commit
be5a1ae272
  1. 1
      src/main.cpp
  2. 4
      src/preferences/options_imp.cpp
  3. 2
      src/qtlibtorrent/qbtsession.cpp

1
src/main.cpp

@ -225,6 +225,7 @@ int main(int argc, char *argv[]) { @@ -225,6 +225,7 @@ int main(int argc, char *argv[]) {
return 0;
}
srand(time(0));
Preferences pref;
#ifndef DISABLE_GUI
bool no_splash = false;

4
src/preferences/options_imp.cpp

@ -40,8 +40,6 @@ @@ -40,8 +40,6 @@
#include <QDesktopServices>
#include <libtorrent/version.hpp>
#include <time.h>
#include <stdlib.h>
#include "options_imp.h"
#include "preferences.h"
@ -781,8 +779,6 @@ void options_imp::loadOptions() { @@ -781,8 +779,6 @@ void options_imp::loadOptions() {
DNSUsernameTxt->setText(pref.getDynDNSUsername());
DNSPasswordTxt->setText(pref.getDynDNSPassword());
// End Web UI
// Random stuff
srand(time(0));
}
// return min & max ports

2
src/qtlibtorrent/qbtsession.cpp

@ -35,7 +35,6 @@ @@ -35,7 +35,6 @@
#include <QHostAddress>
#include <QNetworkAddressEntry>
#include <QProcess>
#include <stdlib.h>
#include "smtp.h"
#include "filesystemwatcher.h"
@ -291,7 +290,6 @@ void QBtSession::configureSession() { @@ -291,7 +290,6 @@ void QBtSession::configureSession() {
if (pref.useRandomPort()) { // to check if the randomPort checkbox is selected
if (!m_randomPortEnabled) {
m_randomPortEnabled = true;
srand(time(0));
const unsigned short randomPort = rand() % USHRT_MAX + 1025;
setListeningPort(randomPort);
addConsoleMessage(tr("qBittorrent is bound to port: TCP/%1", "e.g: qBittorrent is bound to port: 6881").arg(QString::number(getListenPort())));

Loading…
Cancel
Save