Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trackrdrd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
trackrdrd
Commits
7dcb31ce
Commit
7dcb31ce
authored
Feb 20, 2013
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trackrdrd: workers emit MQ client ID to syslog
parent
5b481943
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
2 deletions
+54
-2
amq.cpp
trackrdrd/src/activemq/amq.cpp
+17
-0
amq.h
trackrdrd/src/activemq/amq.h
+2
-0
mq.c
trackrdrd/src/mq.c
+6
-0
test_mq.c
trackrdrd/src/test/test_mq.c
+18
-0
trackrdrd.h
trackrdrd/src/trackrdrd.h
+1
-0
worker.c
trackrdrd/src/worker.c
+10
-2
No files found.
trackrdrd/src/activemq/amq.cpp
View file @
7dcb31ce
...
...
@@ -101,6 +101,13 @@ AMQ_Worker::getVersion() {
return
md
->
getCMSProviderName
()
+
" "
+
md
->
getProviderVersion
();
}
std
::
string
AMQ_Worker
::
getClientID
()
{
if
(
connection
==
NULL
)
throw
cms
::
IllegalStateException
(
"Connection uninitialized"
);
return
connection
->
getClientID
();
}
const
char
*
AMQ_GlobalInit
(
void
)
{
...
...
@@ -149,6 +156,16 @@ AMQ_Version(AMQ_Worker *worker, char *version)
CATCHALL
}
const
char
*
AMQ_ClientID
(
AMQ_Worker
*
worker
,
char
*
clientID
)
{
try
{
strcpy
(
clientID
,
worker
->
getClientID
().
c_str
());
return
NULL
;
}
CATCHALL
}
const
char
*
AMQ_WorkerShutdown
(
AMQ_Worker
**
worker
)
{
...
...
trackrdrd/src/activemq/amq.h
View file @
7dcb31ce
...
...
@@ -62,6 +62,7 @@ public:
virtual
~
AMQ_Worker
();
void
send
(
std
::
string
&
text
);
std
::
string
getVersion
();
std
::
string
getClientID
();
};
#else
typedef
struct
AMQ_Worker
AMQ_Worker
;
...
...
@@ -76,6 +77,7 @@ extern "C" {
char
*
qName
);
const
char
*
AMQ_Send
(
AMQ_Worker
*
worker
,
const
char
*
data
,
unsigned
len
);
const
char
*
AMQ_Version
(
AMQ_Worker
*
worker
,
char
*
version
);
const
char
*
AMQ_ClientID
(
AMQ_Worker
*
worker
,
char
*
clientID
);
const
char
*
AMQ_WorkerShutdown
(
AMQ_Worker
**
worker
);
const
char
*
AMQ_GlobalShutdown
(
void
);
...
...
trackrdrd/src/mq.c
View file @
7dcb31ce
...
...
@@ -96,6 +96,12 @@ MQ_Version(void *priv, char *version)
return
AMQ_Version
((
AMQ_Worker
*
)
priv
,
version
);
}
const
char
*
MQ_ClientID
(
void
*
priv
,
char
*
clientID
)
{
return
AMQ_ClientID
((
AMQ_Worker
*
)
priv
,
clientID
);
}
const
char
*
MQ_WorkerShutdown
(
void
**
priv
)
{
...
...
trackrdrd/src/test/test_mq.c
View file @
7dcb31ce
...
...
@@ -118,6 +118,23 @@ static const char
return
NULL
;
}
static
const
char
*
test_clientID
(
void
)
{
const
char
*
err
;
char
clientID
[
BUFSIZ
];
printf
(
"... testing client ID info
\n
"
);
mu_assert
(
"MQ_ClientID: worker is NULL before call"
,
worker
!=
NULL
);
err
=
MQ_ClientID
(
worker
,
clientID
);
sprintf
(
errmsg
,
"MQ_Version: %s"
,
err
);
mu_assert
(
errmsg
,
err
==
NULL
);
mu_assert
(
"MQ_Version: client ID is empty"
,
clientID
[
0
]
!=
'\0'
);
return
NULL
;
}
static
const
char
*
test_send
(
void
)
{
...
...
@@ -173,6 +190,7 @@ static const char
mu_run_test
(
test_init_connection
);
mu_run_test
(
test_worker_init
);
mu_run_test
(
test_version
);
mu_run_test
(
test_clientID
);
mu_run_test
(
test_send
);
mu_run_test
(
test_worker_shutdown
);
mu_run_test
(
test_global_shutdown
);
...
...
trackrdrd/src/trackrdrd.h
View file @
7dcb31ce
...
...
@@ -152,6 +152,7 @@ const char *MQ_InitConnections(void);
const
char
*
MQ_WorkerInit
(
void
**
priv
);
const
char
*
MQ_Send
(
void
*
priv
,
const
char
*
data
,
unsigned
len
);
const
char
*
MQ_Version
(
void
*
priv
,
char
*
version
);
const
char
*
MQ_ClientID
(
void
*
priv
,
char
*
clientID
);
const
char
*
MQ_WorkerShutdown
(
void
**
priv
);
const
char
*
MQ_GlobalShutdown
(
void
);
...
...
trackrdrd/src/worker.c
View file @
7dcb31ce
...
...
@@ -40,6 +40,7 @@
#include "miniobj.h"
#define VERSION_LEN 64
#define CLIENT_ID_LEN 80
static
int
running
=
0
;
...
...
@@ -137,7 +138,7 @@ static void
void
*
amq_worker
;
dataentry
*
entry
;
const
char
*
err
;
char
version
[
VERSION_LEN
];
char
version
[
VERSION_LEN
]
,
clientID
[
CLIENT_ID_LEN
]
;
LOG_Log
(
LOG_INFO
,
"Worker %d: starting"
,
wrk
->
id
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_DATA_MAGIC
);
...
...
@@ -158,6 +159,12 @@ static void
version
[
0
]
=
'\0'
;
}
err
=
MQ_ClientID
(
amq_worker
,
clientID
);
if
(
err
!=
NULL
)
{
LOG_Log
(
LOG_ERR
,
"Worker %d: Failed to get MQ client ID"
,
wrk
->
id
,
err
);
clientID
[
0
]
=
'\0'
;
}
VSTAILQ_INIT
(
&
wrk
->
wrk_freelist
);
wrk
->
wrk_nfree
=
0
;
...
...
@@ -166,7 +173,8 @@ static void
running
++
;
AZ
(
pthread_mutex_unlock
(
&
running_lock
));
LOG_Log
(
LOG_INFO
,
"Worker %d: running (%s)"
,
wrk
->
id
,
version
);
LOG_Log
(
LOG_INFO
,
"Worker %d: running (%s, id = %s)"
,
wrk
->
id
,
version
,
clientID
);
while
(
run
)
{
entry
=
(
dataentry
*
)
SPMCQ_Deq
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment