diff --git a/src/utils.cpp b/src/utils.cpp index 9b589a0b2..f8abf378e 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -23,6 +23,12 @@ #include #include +#if defined(_MSC_VER) + #include +#else + #include +#endif + namespace cass { std::string opcode_to_string(int opcode) { @@ -157,4 +163,13 @@ std::string& to_cql_id(std::string& str) { return str; } +cass_int32_t get_pid() +{ +#if defined(_MSC_VER) + return static_cast(GetCurrentProcessId()); +#else + return static_cast(getpid()); +#endif +} + } // namespace cass diff --git a/src/utils.hpp b/src/utils.hpp index 17e353127..af27a1b3f 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -91,6 +91,8 @@ std::string& to_cql_id(std::string& str); std::string& escape_id(std::string& str); +cass_int32_t get_pid(); + } // namespace cass #endif diff --git a/src/uuids.cpp b/src/uuids.cpp index d70f893e1..fd0087715 100644 --- a/src/uuids.cpp +++ b/src/uuids.cpp @@ -213,6 +213,10 @@ UuidGen::UuidGen() uv_free_cpu_info(cpu_infos, cpu_count); } + // Tack on the pid + cass_int32_t pid = get_pid(); + md5.update(reinterpret_cast(&pid), 4); + uint8_t hash[16]; md5.final(hash);