Browse Source

Remove old no-self-connect code

It should be implemented at server side
tags/v1.9.10
Nedko Arnaudov 16 years ago
parent
commit
4b85b0963c
2 changed files with 0 additions and 93 deletions
  1. +0
    -88
      common/JackLibClient.cpp
  2. +0
    -5
      common/JackLibClient.h

+ 0
- 88
common/JackLibClient.cpp View File

@@ -168,94 +168,6 @@ JackClientControl* JackLibClient::GetClientControl() const
return fClientControl;
}

int
JackLibClient::NoSelfConnectCheck(const char* src, const char* dst)
{
// this check is to prevent apps to self connect to other apps
// TODO: make this work with multiple clients per app
{
const char * sep_ptr;
const char * client_name_ptr;
int src_self;
int dst_self;

client_name_ptr = GetClientControl()->fName;

//jack_info("Client '%s' (dis)connecting '%s' to '%s'", client_name_ptr, src, dst);

sep_ptr = strchr(src, ':');
if (sep_ptr == NULL)
{
jack_error("source port '%s' is invalid", src);
return -1;
}

src_self = strncmp(client_name_ptr, src, sep_ptr - src) == 0 ? 0 : 1;

sep_ptr = strchr(dst, ':');
if (sep_ptr == NULL)
{
jack_error("destination port '%s' is invalid", dst);
return -1;
}

dst_self = strncmp(client_name_ptr, dst, sep_ptr - dst) == 0 ? 0 : 1;

//jack_info("src_self is %s", src_self ? "true" : "false");
//jack_info("dst_self is %s", dst_self ? "true" : "false");

// 0 means client is connecting other client ports (i.e. control app patchbay functionality)
// 1 means client is connecting its own port to port of other client (i.e. self hooking into system app)
// 2 means client is connecting its own ports (i.e. for app internal functionality)
// TODO: Make this check an engine option and more tweakable (return error or success)
// MAYBE: make the engine option changable on the fly and expose it through client or control API
if (src_self + dst_self != 0)
{
jack_info("ignoring self hook to other client ports ('%s': '%s' -> '%s')", client_name_ptr, src, dst);
return 0;
}
}

return 1;
}

int JackLibClient::PortConnect(const char* src, const char* dst)
{
int ret;

//jack_info("Client connecting '%s' to '%s'", src, dst);

ret = NoSelfConnectCheck(src, dst);
if (ret > 0)
{
return JackClient::PortConnect(src, dst);
}

return ret;
}

int JackLibClient::PortDisconnect(const char* src, const char* dst)
{
int ret;

//jack_info("Client disconnecting '%s' to '%s'", src, dst);

ret = NoSelfConnectCheck(src, dst);
if (ret > 0)
{
return JackClient::PortDisconnect(src, dst);
}

return ret;
}

int JackLibClient::PortDisconnect(jack_port_id_t src)
{
jack_info("Ignoring port disconnect request");

return 0;
}

} // end of namespace




+ 0
- 5
common/JackLibClient.h View File

@@ -51,11 +51,6 @@ class JackLibClient : public JackClient
JackGraphManager* GetGraphManager() const;
JackEngineControl* GetEngineControl() const;
JackClientControl* GetClientControl() const;

int NoSelfConnectCheck(const char* src, const char* dst);
virtual int PortConnect(const char* src, const char* dst);
virtual int PortDisconnect(const char* src, const char* dst);
virtual int PortDisconnect(jack_port_id_t src);
};




Loading…
Cancel
Save