mirror of
https://github.com/ossrs/srs.git
synced 2025-02-12 11:21:52 +00:00
For #2424, use srandom/random to generate. 3.0.164
This commit is contained in:
parent
e7435a6237
commit
d72d05294d
10 changed files with 25 additions and 16 deletions
|
@ -137,6 +137,8 @@ Other important wiki:
|
|||
|
||||
## V3 changes
|
||||
|
||||
* <strong>v3.0, 2021-07-04, [3.0 release7(3.0.164)](https://github.com/ossrs/srs/releases/tag/v3.0-r7) released. 123463 lines.</strong>
|
||||
* v3.0, 2021-07-04, For [#2424](https://github.com/ossrs/srs/issues/2424), use srandom/random to generate. 3.0.164
|
||||
* <strong>v3.0, 2021-06-26, [3.0 release6(3.0.163)](https://github.com/ossrs/srs/releases/tag/v3.0-r6) released. 123011 lines.</strong>
|
||||
* v3.0, 2021-06-26, For [#2424](https://github.com/ossrs/srs/issues/2424), query the latest available version. 3.0.163
|
||||
* v3.0, 2021-05-12, Fix [#2311][bug #2311], Copy the request for stat client. 3.0.162
|
||||
|
@ -342,6 +344,8 @@ Other important wiki:
|
|||
|
||||
## V2 changes
|
||||
|
||||
* <strong>v2.0, 2021-07-04, [2.0 release9(2.0.274)](https://github.com/ossrs/srs/releases/tag/v2.0-r10) released. 87575 lines.</strong>
|
||||
* v2.0, 2021-07-04, For [#2424](https://github.com/ossrs/srs/issues/2424), use srandom/random to generate. 2.0.274
|
||||
* <strong>v2.0, 2021-06-26, [2.0 release9(2.0.273)](https://github.com/ossrs/srs/releases/tag/v2.0-r9) released. 87552 lines.</strong>
|
||||
* v2.0, 2021-06-25, For [#2424](https://github.com/ossrs/srs/issues/2424), query the latest available version. 2.0.273
|
||||
* <strong>v2.0, 2020-01-25, [2.0 release8(2.0.272)][r2.0r8] released. 87292 lines.</strong>
|
||||
|
|
1
trunk/.gitignore
vendored
1
trunk/.gitignore
vendored
|
@ -13,6 +13,7 @@
|
|||
/ide/srs_xcode/srs_xcode.xcodeproj/xcuserdata/
|
||||
/research/aac/
|
||||
/research/api-server/static-dir/mse
|
||||
/research/api-server/static-dir/crossdomain.xml
|
||||
/research/bat/
|
||||
/research/big/
|
||||
/research/bitch/
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<cross-domain-policy>
|
||||
<allow-access-from domain="*"/>
|
||||
</cross-domain-policy>
|
|
@ -484,7 +484,7 @@ void SrsIngester::show_ingest_log_message()
|
|||
}
|
||||
|
||||
// random choose one ingester to report.
|
||||
int index = rand() % (int)ingesters.size();
|
||||
int index = srs_random() % (int)ingesters.size();
|
||||
SrsIngesterFFMPEG* ingester = ingesters.at(index);
|
||||
|
||||
// reportable
|
||||
|
|
|
@ -54,7 +54,7 @@ srs_error_t SrsLatestVersion::start()
|
|||
return srs_success;
|
||||
}
|
||||
|
||||
char buf[10];
|
||||
char buf[16];
|
||||
srs_random_generate(buf, sizeof(buf));
|
||||
for (int i = 0; i < (int)sizeof(buf); i++) {
|
||||
buf[i] = 'a' + uint8_t(buf[i])%25;
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
#ifndef SRS_CORE_VERSION3_HPP
|
||||
#define SRS_CORE_VERSION3_HPP
|
||||
|
||||
#define SRS_VERSION3_REVISION 163
|
||||
#define SRS_VERSION3_REVISION 164
|
||||
|
||||
#endif
|
||||
|
|
|
@ -150,18 +150,23 @@ void srs_parse_query_string(string q, map<string,string>& query)
|
|||
|
||||
void srs_random_generate(char* bytes, int size)
|
||||
{
|
||||
static bool _random_initialized = false;
|
||||
if (!_random_initialized) {
|
||||
srand(0);
|
||||
_random_initialized = true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
// the common value in [0x0f, 0xf0]
|
||||
bytes[i] = 0x0f + (rand() % (256 - 0x0f - 0x0f));
|
||||
bytes[i] = 0x0f + (srs_random() % (256 - 0x0f - 0x0f));
|
||||
}
|
||||
}
|
||||
|
||||
long srs_random()
|
||||
{
|
||||
static bool _random_initialized = false;
|
||||
if (!_random_initialized) {
|
||||
_random_initialized = true;
|
||||
srandom((unsigned int)srs_get_system_startup_time());
|
||||
}
|
||||
|
||||
return random();
|
||||
}
|
||||
|
||||
string srs_generate_tc_url(string host, string vhost, string app, int port)
|
||||
{
|
||||
string tcUrl = "rtmp://";
|
||||
|
|
|
@ -69,6 +69,8 @@ extern void srs_parse_query_string(std::string q, std::map<std::string, std::str
|
|||
* generate ramdom data for handshake.
|
||||
*/
|
||||
extern void srs_random_generate(char* bytes, int size);
|
||||
// Generate random value, use srandom(now_us) to init seed if not initialized.
|
||||
extern long srs_random();
|
||||
|
||||
/**
|
||||
* generate the tcUrl without param.
|
||||
|
|
|
@ -357,7 +357,7 @@ namespace srs_internal
|
|||
|
||||
key_block::key_block()
|
||||
{
|
||||
offset = (int32_t)rand();
|
||||
offset = (int32_t)srs_random();
|
||||
random0 = NULL;
|
||||
random1 = NULL;
|
||||
|
||||
|
@ -439,7 +439,7 @@ namespace srs_internal
|
|||
|
||||
digest_block::digest_block()
|
||||
{
|
||||
offset = (int32_t)rand();
|
||||
offset = (int32_t)srs_random();
|
||||
random0 = NULL;
|
||||
random1 = NULL;
|
||||
|
||||
|
|
Loading…
Reference in a new issue