Skip to content

Commit

Permalink
API: Use libuuid to generate uuid. v4.0.147
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Aug 6, 2021
1 parent 529b89a commit 48ef3dc
Show file tree
Hide file tree
Showing 6 changed files with 1,446 additions and 4 deletions.
2 changes: 1 addition & 1 deletion trunk/configure
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_sourc
"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" "srs_app_hybrid" "srs_app_threads")
if [[ $SRS_RTC == YES ]]; then
Expand Down
12 changes: 11 additions & 1 deletion 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,7 +55,16 @@ srs_error_t SrsLatestVersion::start()
return srs_success;
}

server_id_ = srs_random_str(16);
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));
}

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

0 comments on commit 48ef3dc

Please sign in to comment.