summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Perrin2012-08-28 10:01:50 (EDT)
committer Eugene Tarassov2012-08-29 14:55:12 (EDT)
commit556c44911d0785ba6a8ff86f609e418455a20e68 (patch)
treee2b21a1e7a4c2a0a63ba04ac72808accde6a4524
parentc5e06202cef5fbf12877c1d0e550d655810884ff (diff)
downloadorg.eclipse.tcf.agent-556c44911d0785ba6a8ff86f609e418455a20e68.zip
org.eclipse.tcf.agent-556c44911d0785ba6a8ff86f609e418455a20e68.tar.gz
org.eclipse.tcf.agent-556c44911d0785ba6a8ff86f609e418455a20e68.tar.bz2
Add possibility to specify the basename of a stream ID.
In order to add the virtual stream service in a Value-Add and in an agent at the same time, both services must use different stream identifiers. STREAM_BASE_ID define can be set at build time to change the basename of the stream identifiers.
-rw-r--r--agent/tcf/services/streamsservice.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/agent/tcf/services/streamsservice.c b/agent/tcf/services/streamsservice.c
index 2cc3b7f..ea34a71 100644
--- a/agent/tcf/services/streamsservice.c
+++ b/agent/tcf/services/streamsservice.c
@@ -41,6 +41,10 @@ typedef struct Subscription Subscription;
#define STREAM_MAGIC 0x29465398
+#ifndef STREAM_BASE_ID
+#define STREAM_BASE_ID "VS"
+#endif
+
struct VirtualStream {
LINK link_all;
unsigned magic;
@@ -117,15 +121,17 @@ static unsigned get_client_hash(unsigned id, Channel * c) {
}
static int str2id(char * s, unsigned * id) {
+ const char * stream_base_id = STREAM_BASE_ID;
char * p = NULL;
- if (*s++ != 'V') return 0;
- if (*s++ != 'S') return 0;
+ while (*stream_base_id != 0) {
+ if (*s++ != *stream_base_id++) return 0;
+ }
*id = (unsigned)strtoul(s, &p, 10);
return *p == 0;
}
void virtual_stream_get_id(VirtualStream * stream, char * id_buf, size_t buf_size) {
- snprintf(id_buf, buf_size, "VS%u", stream->id);
+ snprintf(id_buf, buf_size, STREAM_BASE_ID"%u", stream->id);
}
static StreamClient * find_client(char * s, Channel * c) {
@@ -818,7 +824,7 @@ static void channel_close_listener(Channel * c) {
StreamClient * client = all2client(l);
l = l->next;
if (client->channel == c) {
- trace(LOG_ALWAYS, "Stream is left connected by client: VS%d", client->stream->id);
+ trace(LOG_ALWAYS, "Stream is left connected by client: "STREAM_BASE_ID"%d", client->stream->id);
delete_client(client);
}
}