git-svn-id: svn://db.shs.com.ru/pip@384 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -908,7 +908,7 @@ void PIConsole::listenServers() {
|
|||||||
server_mode = false;
|
server_mode = false;
|
||||||
server_name.clear();
|
server_name.clear();
|
||||||
randomize();
|
randomize();
|
||||||
peer = new PIPeer("_rcc_:" + PIDateTime::current().toString("hhmmssddMMyy_") + PIString::fromNumber(rand()));
|
peer = new PIPeer("_rcc_:" + PIDateTime::current().toString("hhmmssddMMyy_") + PIString::fromNumber(randomi()));
|
||||||
CONNECT2(void, const PIString & , const PIByteArray &, peer, dataReceivedEvent, this, peerReceived);
|
CONNECT2(void, const PIString & , const PIByteArray &, peer, dataReceivedEvent, this, peerReceived);
|
||||||
peer_timer->start(100.);
|
peer_timer->start(100.);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -747,7 +747,7 @@ bool PITerminal::initialize() {
|
|||||||
|
|
||||||
memset(&PRIVATE->pi, 0, sizeof(PRIVATE->pi));
|
memset(&PRIVATE->pi, 0, sizeof(PRIVATE->pi));
|
||||||
|
|
||||||
PIString shmh = PIString::fromNumber(rand() % 10000);
|
PIString shmh = PIString::fromNumber(randomi() % 10000);
|
||||||
PIString pname = "\\\\.\\pipe\\piterm" + shmh;
|
PIString pname = "\\\\.\\pipe\\piterm" + shmh;
|
||||||
PIString cmd = "piterminal \"" + shmh + "\" \"" + pname + "\"";
|
PIString cmd = "piterminal \"" + shmh + "\" \"" + pname + "\"";
|
||||||
if(!CreateProcessA(0, (LPSTR)cmd.dataAscii(), 0, 0, false, CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP, 0, 0, &PRIVATE->si, &PRIVATE->pi)) {
|
if(!CreateProcessA(0, (LPSTR)cmd.dataAscii(), 0, 0, false, CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP, 0, 0, &PRIVATE->si, &PRIVATE->pi)) {
|
||||||
|
|||||||
@@ -252,3 +252,8 @@ int main(int argc, char * argv[]) {
|
|||||||
void piqsort(void * base, size_t num, size_t size, int (*compar)(const void *, const void *)) {
|
void piqsort(void * base, size_t num, size_t size, int (*compar)(const void *, const void *)) {
|
||||||
qsort(base, num, size, compar);
|
qsort(base, num, size, compar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int randomi() {
|
||||||
|
return rand();
|
||||||
|
}
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ void errorClear();
|
|||||||
|
|
||||||
void piqsort(void* base, size_t num, size_t size, int (*compar)(const void*,const void*));
|
void piqsort(void* base, size_t num, size_t size, int (*compar)(const void*,const void*));
|
||||||
|
|
||||||
|
int randomi();
|
||||||
|
|
||||||
/// Return readable version of PIP
|
/// Return readable version of PIP
|
||||||
PIString PIPVersion();
|
PIString PIPVersion();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "pibasetransfer.h"
|
#include "pibasetransfer.h"
|
||||||
#include "piincludes_p.h"
|
|
||||||
|
|
||||||
|
|
||||||
const uint PIBaseTransfer::signature = 0x54424950;
|
const uint PIBaseTransfer::signature = 0x54424950;
|
||||||
@@ -352,7 +351,7 @@ void PIBaseTransfer::buildSession(PIVector<Part> parts) {
|
|||||||
mutex_header.lock();
|
mutex_header.lock();
|
||||||
state_string = "calculating parts ... ";
|
state_string = "calculating parts ... ";
|
||||||
session.clear();
|
session.clear();
|
||||||
header.session_id = rand();
|
header.session_id = randomi();
|
||||||
bytes_all = 0;
|
bytes_all = 0;
|
||||||
Part fi;
|
Part fi;
|
||||||
int fi_index, fi_prts;
|
int fi_index, fi_prts;
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ bool PIFileTransfer::sendFiles(const PIVector<PFTFileInfo> &files) {
|
|||||||
// piCout << "prepare" << i << files_[i].path << files_[i].dest_path << files_[i].name();
|
// piCout << "prepare" << i << files_[i].path << files_[i].dest_path << files_[i].name();
|
||||||
}
|
}
|
||||||
randomize();
|
randomize();
|
||||||
pftheader.session_id = rand();
|
pftheader.session_id = randomi();
|
||||||
sendFilesStarted();
|
sendFilesStarted();
|
||||||
cur_file_string = "build session";
|
cur_file_string = "build session";
|
||||||
desc.clear();
|
desc.clear();
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ PIPeer::PIPeer(const PIString & n): PIIODevice(), inited__(false), eth_tcp_srv(P
|
|||||||
self_info.time = PISystemTime::current();
|
self_info.time = PISystemTime::current();
|
||||||
//joinMulticastGroup("239.240.241.242");
|
//joinMulticastGroup("239.240.241.242");
|
||||||
randomize();
|
randomize();
|
||||||
//id_ = self_info.name + "_" + PIString::fromNumber(rand());
|
//id_ = self_info.name + "_" + PIString::fromNumber(randomi());
|
||||||
CONNECTU(&sync_timer, tickEvent, this, timerEvent);
|
CONNECTU(&sync_timer, tickEvent, this, timerEvent);
|
||||||
prev_ifaces = PIEthernet::interfaces();
|
prev_ifaces = PIEthernet::interfaces();
|
||||||
no_timer = false;
|
no_timer = false;
|
||||||
@@ -912,7 +912,7 @@ void PIPeer::reinit() {
|
|||||||
|
|
||||||
void PIPeer::changeName(const PIString &new_name) {
|
void PIPeer::changeName(const PIString &new_name) {
|
||||||
PIString name_ = new_name;
|
PIString name_ = new_name;
|
||||||
if (name_.isEmpty()) name_ = "rnd_" + PIString::fromNumber(random() % 1000);
|
if (name_.isEmpty()) name_ = "rnd_" + PIString::fromNumber(randomi() % 1000);
|
||||||
setName(name_);
|
setName(name_);
|
||||||
self_info.name = name_;
|
self_info.name = name_;
|
||||||
diag_d.setName(name_+"_data");
|
diag_d.setName(name_+"_data");
|
||||||
|
|||||||
@@ -476,11 +476,5 @@ double randomn(double dv, double sv) {
|
|||||||
|
|
||||||
|
|
||||||
double randomd() {
|
double randomd() {
|
||||||
return (double)
|
return (double) randomi() / RAND_MAX * 2. - 1.;
|
||||||
#ifdef QNX
|
|
||||||
rand()
|
|
||||||
#else
|
|
||||||
random()
|
|
||||||
#endif
|
|
||||||
/ RAND_MAX * 2. - 1.;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,9 +89,6 @@
|
|||||||
#ifndef M_GRAVITY_CONST
|
#ifndef M_GRAVITY_CONST
|
||||||
# define M_GRAVITY_CONST 398600.4418e9;
|
# define M_GRAVITY_CONST 398600.4418e9;
|
||||||
#endif
|
#endif
|
||||||
#ifdef WINDOWS
|
|
||||||
inline int random() {return rand();}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using std::complex;
|
using std::complex;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "piintrospection.h"
|
#include "piintrospection.h"
|
||||||
#include "pisysteminfo.h"
|
#include "pisysteminfo.h"
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
|
|
||||||
PIIntrospectionContainers::PIIntrospectionContainers() {
|
PIIntrospectionContainers::PIIntrospectionContainers() {
|
||||||
@@ -105,7 +104,7 @@ PIIntrospectionServer::PIIntrospectionServer(): PIPeer(genName()) {
|
|||||||
|
|
||||||
PIString PIIntrospectionServer::genName() {
|
PIString PIIntrospectionServer::genName() {
|
||||||
randomize();
|
randomize();
|
||||||
return "__introspection__server_" + PIString::fromNumber(rand() % 1000);
|
return "__introspection__server_" + PIString::fromNumber(randomi() % 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ void Daemon::TileFileProgress::tileEvent(PIScreenTile * t, TileEvent e) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Daemon::Daemon(): PIPeer(pisd_prefix + PISystemInfo::instance()->hostname + "_" + PIString(rand() % 100)) {
|
Daemon::Daemon(): PIPeer(pisd_prefix + PISystemInfo::instance()->hostname + "_" + PIString(randomi() % 100)) {
|
||||||
// setName("Daemon");
|
// setName("Daemon");
|
||||||
dtimer.setName("__S__Daemon_timer");
|
dtimer.setName("__S__Daemon_timer");
|
||||||
mode = rmNone;
|
mode = rmNone;
|
||||||
|
|||||||
Reference in New Issue
Block a user