Browse Source

Fix generation of client uuid

Signed-off-by: falkTX <falktx@falktx.com>
tags/v1.9.13
falkTX 6 years ago
parent
commit
bf8e5b5ea9
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 5 additions and 14 deletions
  1. +5
    -12
      common/JackEngine.cpp
  2. +0
    -2
      common/JackEngine.h

+ 5
- 12
common/JackEngine.cpp View File

@@ -52,7 +52,6 @@ JackEngine::JackEngine(JackGraphManager* manager,
fClientTable[i] = NULL; fClientTable[i] = NULL;
} }
fLastSwitchUsecs = 0; fLastSwitchUsecs = 0;
fMaxUUID = 0;
fSessionPendingReplies = 0; fSessionPendingReplies = 0;
fSessionTransaction = NULL; fSessionTransaction = NULL;
fSessionResult = NULL; fSessionResult = NULL;
@@ -564,21 +563,15 @@ bool JackEngine::ClientCheckName(const char* name)
return false; return false;
} }


int JackEngine::GetNewUUID()
{
return fMaxUUID++;
}

void JackEngine::EnsureUUID(int uuid) void JackEngine::EnsureUUID(int uuid)
{ {
if (uuid > fMaxUUID) {
fMaxUUID = uuid + 1;
}
if (uuid == 0)
return;


for (int i = 0; i < CLIENT_NUM; i++) { for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i]; JackClientInterface* client = fClientTable[i];
if (client && (client->GetClientControl()->fSessionID == uuid)) { 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]; char real_name[JACK_CLIENT_NAME_SIZE + 1];


if (uuid < 0) { if (uuid < 0) {
uuid = GetNewUUID();
uuid = jack_client_uuid_generate();
strncpy(real_name, name, JACK_CLIENT_NAME_SIZE); strncpy(real_name, name, JACK_CLIENT_NAME_SIZE);
} else { } else {
std::map<int, std::string>::iterator res = fReservationMap.find(uuid); 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++) { for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i]; JackClientInterface* client = fClientTable[i];
if (client && (client->GetClientControl()->fSessionID < 0)) { if (client && (client->GetClientControl()->fSessionID < 0)) {
client->GetClientControl()->fSessionID = GetNewUUID();
client->GetClientControl()->fSessionID = jack_client_uuid_generate();
} }
} }
fSessionResult = new JackSessionNotifyResult(); fSessionResult = new JackSessionNotifyResult();


+ 0
- 2
common/JackEngine.h View File

@@ -60,7 +60,6 @@ class SERVER_EXPORT JackEngine : public JackLockAble
detail::JackChannelTransactionInterface* fSessionTransaction; detail::JackChannelTransactionInterface* fSessionTransaction;
JackSessionNotifyResult* fSessionResult; JackSessionNotifyResult* fSessionResult;
std::map<int,std::string> fReservationMap; std::map<int,std::string> fReservationMap;
int fMaxUUID;


int ClientCloseAux(int refnum, bool wait); int ClientCloseAux(int refnum, bool wait);
void CheckXRun(jack_time_t callback_usecs); 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 NotifyPortRename(jack_port_id_t src, const char* old_name);
void NotifyActivate(int refnum); void NotifyActivate(int refnum);


int GetNewUUID();
void EnsureUUID(int uuid); void EnsureUUID(int uuid);


bool CheckClient(int refnum) bool CheckClient(int refnum)


Loading…
Cancel
Save