diff --git a/README.md b/README.md
index a551ea128..6743d07b4 100755
--- a/README.md
+++ b/README.md
@@ -137,6 +137,8 @@ Other important wiki:
## V3 changes
+* v3.0, 2021-07-04, [3.0 release7(3.0.164)](https://github.com/ossrs/srs/releases/tag/v3.0-r7) released. 123463 lines.
+* v3.0, 2021-07-04, For [#2424](https://github.com/ossrs/srs/issues/2424), use srandom/random to generate. 3.0.164
* v3.0, 2021-06-26, [3.0 release6(3.0.163)](https://github.com/ossrs/srs/releases/tag/v3.0-r6) released. 123011 lines.
* 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
+* v2.0, 2021-07-04, [2.0 release9(2.0.274)](https://github.com/ossrs/srs/releases/tag/v2.0-r10) released. 87575 lines.
+* v2.0, 2021-07-04, For [#2424](https://github.com/ossrs/srs/issues/2424), use srandom/random to generate. 2.0.274
* v2.0, 2021-06-26, [2.0 release9(2.0.273)](https://github.com/ossrs/srs/releases/tag/v2.0-r9) released. 87552 lines.
* v2.0, 2021-06-25, For [#2424](https://github.com/ossrs/srs/issues/2424), query the latest available version. 2.0.273
* v2.0, 2020-01-25, [2.0 release8(2.0.272)][r2.0r8] released. 87292 lines.
diff --git a/trunk/.gitignore b/trunk/.gitignore
index 7d0164b16..5ab388b11 100644
--- a/trunk/.gitignore
+++ b/trunk/.gitignore
@@ -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/
diff --git a/trunk/research/api-server/static-dir/crossdomain.xml b/trunk/research/api-server/static-dir/crossdomain.xml
deleted file mode 100644
index ae9108482..000000000
--- a/trunk/research/api-server/static-dir/crossdomain.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/trunk/src/app/srs_app_ingest.cpp b/trunk/src/app/srs_app_ingest.cpp
index 44987f16c..4ca1db87c 100644
--- a/trunk/src/app/srs_app_ingest.cpp
+++ b/trunk/src/app/srs_app_ingest.cpp
@@ -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
diff --git a/trunk/src/app/srs_app_latest_version.cpp b/trunk/src/app/srs_app_latest_version.cpp
index bec42d8fa..70cb9201b 100644
--- a/trunk/src/app/srs_app_latest_version.cpp
+++ b/trunk/src/app/srs_app_latest_version.cpp
@@ -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;
diff --git a/trunk/src/core/srs_core_version3.hpp b/trunk/src/core/srs_core_version3.hpp
index 040006ced..c18ea6914 100644
--- a/trunk/src/core/srs_core_version3.hpp
+++ b/trunk/src/core/srs_core_version3.hpp
@@ -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
diff --git a/trunk/src/kernel/srs_kernel_utility.cpp b/trunk/src/kernel/srs_kernel_utility.cpp
index cd5e27e7d..09060b720 100644
--- a/trunk/src/kernel/srs_kernel_utility.cpp
+++ b/trunk/src/kernel/srs_kernel_utility.cpp
@@ -119,7 +119,7 @@ srs_utime_t srs_get_system_startup_time()
if (_srs_system_time_startup_time <= 0) {
srs_update_system_time();
}
-
+
return _srs_system_time_startup_time;
}
diff --git a/trunk/src/protocol/srs_protocol_utility.cpp b/trunk/src/protocol/srs_protocol_utility.cpp
index 3937ddc29..5d00f5df3 100644
--- a/trunk/src/protocol/srs_protocol_utility.cpp
+++ b/trunk/src/protocol/srs_protocol_utility.cpp
@@ -150,18 +150,23 @@ void srs_parse_query_string(string q, map& 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://";
diff --git a/trunk/src/protocol/srs_protocol_utility.hpp b/trunk/src/protocol/srs_protocol_utility.hpp
index 777ec1900..36ecbb07e 100644
--- a/trunk/src/protocol/srs_protocol_utility.hpp
+++ b/trunk/src/protocol/srs_protocol_utility.hpp
@@ -69,6 +69,8 @@ extern void srs_parse_query_string(std::string q, std::map