diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-09-12 06:57:25 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-09-12 06:57:25 +0000 |
commit | df89b4853954b7dcc86839167760cf72af693656 (patch) | |
tree | 4ca20ea06776c4eaf527e4bcf13198cd49ee581d /source3/utils | |
parent | f0ce4f7ae3b58f45b70598e3a44539e3e12291ce (diff) | |
download | samba-df89b4853954b7dcc86839167760cf72af693656.tar.gz samba-df89b4853954b7dcc86839167760cf72af693656.tar.bz2 samba-df89b4853954b7dcc86839167760cf72af693656.zip |
- fixed some memory leaks in the messages code
- added a MSG_PING message for performance testing.
(This used to be commit e779f834dbb875669c3aa0a35b324aa13f0c8c36)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/msgtest.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/source3/utils/msgtest.c b/source3/utils/msgtest.c index 22d7a9a331..4821aef80b 100644 --- a/source3/utils/msgtest.c +++ b/source3/utils/msgtest.c @@ -36,12 +36,21 @@ #include "includes.h" +static int pong_count; + +/**************************************************************************** +a useful function for testing the message system +****************************************************************************/ +void pong_message(int msg_type, pid_t src, void *buf, size_t len) +{ + pong_count++; +} int main(int argc, char *argv[]) { pid_t pid; - int level; + int i, n; static pstring servicesf = CONFIGFILE; TimeInit(); @@ -54,9 +63,18 @@ message_init(); pid = atoi(argv[1]); - level = atoi(argv[2]); + n = atoi(argv[2]); + + message_register(MSG_PONG, pong_message); + + for (i=0;i<n;i++) { + message_send_pid(pid, MSG_PING, NULL, 0); + } - message_send_pid(pid, MSG_FORCE_ELECTION, NULL, 0); + while (pong_count < n) { + message_dispatch(); + msleep(1); + } return (0); } |