Skip to content

Commit

Permalink
API: Use libuuid to generate uuid. v3.0.165
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Aug 6, 2021
1 parent ea06416 commit 5c6bb63
Show file tree
Hide file tree
Showing 5 changed files with 1,444 additions and 7 deletions.
2 changes: 1 addition & 1 deletion trunk/configure
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
"srs_app_heartbeat" "srs_app_empty" "srs_app_http_client" "srs_app_http_static"
"srs_app_recv_thread" "srs_app_security" "srs_app_statistic" "srs_app_hds"
"srs_app_mpegts_udp" "srs_app_rtsp" "srs_app_listener" "srs_app_async_call"
"srs_app_caster_flv" "srs_app_latest_version" "srs_app_process" "srs_app_ng_exec"
"srs_app_caster_flv" "srs_app_latest_version" "srs_app_uuid" "srs_app_process" "srs_app_ng_exec"
"srs_app_hourglass" "srs_app_dash" "srs_app_fragment" "srs_app_dvr"
"srs_app_coworkers")
DEFINES=""
Expand Down
15 changes: 10 additions & 5 deletions trunk/src/app/srs_app_latest_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_http_conn.hpp>
#include <srs_app_http_client.hpp>
#include <srs_app_utility.hpp>
#include <srs_app_uuid.hpp>

#include <unistd.h>
#include <sstream>
Expand All @@ -54,12 +55,16 @@ srs_error_t SrsLatestVersion::start()
return srs_success;
}

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;
if (true) {
uuid_t uuid;
uuid_generate_time(uuid);

char buf[32];
for (int i = 0; i < 16; i++) {
snprintf(buf + i * 2, sizeof(buf), "%02x", uuid[i]);
}
server_id_ = string(buf, sizeof(buf));
}
server_id_ = string(buf, sizeof(buf));

return trd_->start();
}
Expand Down
Loading

0 comments on commit 5c6bb63

Please sign in to comment.