Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
#include <functional>
#include <sstream>

#if defined(_MSC_VER)
#include <windows.h>
#else
#include <unistd.h>
#endif

namespace cass {

std::string opcode_to_string(int opcode) {
Expand Down Expand Up @@ -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<cass_int32_t>(GetCurrentProcessId());
#else
return static_cast<cass_int32_t>(getpid());
#endif
}

} // namespace cass
2 changes: 2 additions & 0 deletions src/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions src/uuids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const uint8_t*>(&pid), 4);

uint8_t hash[16];
md5.final(hash);

Expand Down