diff --git a/common/JackChannel.h b/common/JackChannel.h index 688b30eb..1567b3c6 100644 --- a/common/JackChannel.h +++ b/common/JackChannel.h @@ -132,6 +132,9 @@ class JackClientChannelInterface virtual void SessionReply(int refnum, int *result) {} + + virtual bool IsChannelThread() + { return false; } }; } diff --git a/common/JackClient.cpp b/common/JackClient.cpp index d456b077..1baba527 100644 --- a/common/JackClient.cpp +++ b/common/JackClient.cpp @@ -285,7 +285,14 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, snprintf( uuid_buf, sizeof(uuid_buf), "%d", GetClientControl()->fSessionID ); event->client_uuid = strdup( uuid_buf ); + fImmediateSessionReply = false; + fSession(event, fSessionArg); + + if (fImmediateSessionReply) + res = 1; + else + res = 2; } break; } @@ -1088,11 +1095,15 @@ int JackClient::SessionReply( jack_session_event_t *ev ) GetClientControl()->fSessionFlags = ev->flags; - if (fThread.IsThread()) { + jack_log( "JackClient::SessionReply... we are here" ); + if (fChannel->IsChannelThread()) { + jack_log( "JackClient::SessionReply... in callback reply" ); fImmediateSessionReply = true; return 0; } + jack_log( "JackClient::SessionReply... out of cb" ); + int res; fChannel->SessionReply( GetClientControl()->fRefNum, &res); return res; diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index 5f47f73b..a9cd93a0 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -890,6 +890,8 @@ void JackEngine::SessionNotify(int refnum, const char *target, jack_session_even jack_log("JackEngine::SessionNotify ... sending"); int result = client->ClientNotify(i, client->GetClientControl()->fName, kSessionCallback, true, path, (int) type, 0); + jack_log("JackEngine::SessionNotify ... got reply: %d", result); + if (result == 2) { fSessionPendingReplies += 1; } else if (result == 1) { diff --git a/posix/JackSocketClientChannel.h b/posix/JackSocketClientChannel.h index fc8e84cb..8191af15 100644 --- a/posix/JackSocketClientChannel.h +++ b/posix/JackSocketClientChannel.h @@ -97,6 +97,8 @@ class JackSocketClientChannel : public detail::JackClientChannelInterface, publi void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char* path, jack_session_command_t** result); void SessionReply(int refnum, int* result); + + bool IsChannelThread() { return fThread.IsThread(); } }; } // end of namespace