diff options
author | falkTX <falktx@falktx.com> | 2019-03-17 19:01:11 +0100 |
---|---|---|
committer | falkTX <falktx@falktx.com> | 2019-03-17 19:01:11 +0100 |
commit | bf8e5b5ea9322f95d0e0883bd2f4ee1f1cbbf6f2 (patch) | |
tree | 06ff8178a3da9d42332ffb338301e2dc4a788e95 | |
parent | bb3f5cb2963dc74ba045a1553e05f755af8623cc (diff) | |
download | jack2-bf8e5b5ea9322f95d0e0883bd2f4ee1f1cbbf6f2.tar.gz |
Fix generation of client uuid
Signed-off-by: falkTX <falktx@falktx.com>
-rw-r--r-- | common/JackEngine.cpp | 17 | ||||
-rw-r--r-- | common/JackEngine.h | 2 |
2 files changed, 5 insertions, 14 deletions
diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index 37d1022d..610d15d1 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -52,7 +52,6 @@ JackEngine::JackEngine(JackGraphManager* manager, fClientTable[i] = NULL; } fLastSwitchUsecs = 0; - fMaxUUID = 0; fSessionPendingReplies = 0; fSessionTransaction = NULL; fSessionResult = NULL; @@ -564,21 +563,15 @@ bool JackEngine::ClientCheckName(const char* name) return false; } -int JackEngine::GetNewUUID() -{ - return fMaxUUID++; -} - void JackEngine::EnsureUUID(int uuid) { - if (uuid > fMaxUUID) { - fMaxUUID = uuid + 1; - } + if (uuid == 0) + return; for (int i = 0; i < CLIENT_NUM; i++) { JackClientInterface* client = fClientTable[i]; if (client && (client->GetClientControl()->fSessionID == uuid)) { - client->GetClientControl()->fSessionID = GetNewUUID(); + client->GetClientControl()->fSessionID = 0; } } } @@ -613,7 +606,7 @@ int JackEngine::ClientExternalOpen(const char* name, int pid, int uuid, int* ref char real_name[JACK_CLIENT_NAME_SIZE + 1]; if (uuid < 0) { - uuid = GetNewUUID(); + uuid = jack_client_uuid_generate(); strncpy(real_name, name, JACK_CLIENT_NAME_SIZE); } else { std::map<int, std::string>::iterator res = fReservationMap.find(uuid); @@ -1083,7 +1076,7 @@ void JackEngine::SessionNotify(int refnum, const char *target, jack_session_even for (int i = 0; i < CLIENT_NUM; i++) { JackClientInterface* client = fClientTable[i]; if (client && (client->GetClientControl()->fSessionID < 0)) { - client->GetClientControl()->fSessionID = GetNewUUID(); + client->GetClientControl()->fSessionID = jack_client_uuid_generate(); } } fSessionResult = new JackSessionNotifyResult(); diff --git a/common/JackEngine.h b/common/JackEngine.h index 302f1698..d7549f17 100644 --- a/common/JackEngine.h +++ b/common/JackEngine.h @@ -60,7 +60,6 @@ class SERVER_EXPORT JackEngine : public JackLockAble detail::JackChannelTransactionInterface* fSessionTransaction; JackSessionNotifyResult* fSessionResult; std::map<int,std::string> fReservationMap; - int fMaxUUID; int ClientCloseAux(int refnum, bool wait); void CheckXRun(jack_time_t callback_usecs); @@ -87,7 +86,6 @@ class SERVER_EXPORT JackEngine : public JackLockAble void NotifyPortRename(jack_port_id_t src, const char* old_name); void NotifyActivate(int refnum); - int GetNewUUID(); void EnsureUUID(int uuid); bool CheckClient(int refnum) |