Permit experimentation with multiple consumers and different kinds of node

This commit is contained in:
Tony Garnock-Jones 2011-01-06 09:55:51 -05:00
parent 7495ea840b
commit 444dde2a09
1 changed files with 15 additions and 2 deletions

View File

@ -65,12 +65,24 @@ int main(int argc, char *argv[]) {
long bytecount = -1; long bytecount = -1;
size_t message_size = 0; size_t message_size = 0;
long last_report_bytecount = 0; long last_report_bytecount = 0;
char idchar = '1';
char *qclass = "queue";
if (argc < 2) { if (argc < 2) {
fprintf(stderr, "Usage: test1 <serverhostname>\n"); fprintf(stderr, "Usage: test1 <serverhostname> [<idchar> [<qclass>]]\n");
exit(1); exit(1);
} }
if (argc > 2) {
idchar = argv[2][0];
}
printf("Idchar: '%c'\n", idchar);
if (argc > 3) {
qclass = argv[3];
}
printf("Qclass: %s\n", qclass);
{ {
struct hostent *h = gethostbyname(argv[1]); struct hostent *h = gethostbyname(argv[1]);
if (h == NULL) { if (h == NULL) {
@ -91,7 +103,8 @@ int main(int argc, char *argv[]) {
f = fdopen(fd, "a+"); f = fdopen(fd, "a+");
fprintf(f, "(9:subscribe5:test10:0:5:test15:login)(4:post7:factory(6:create5:queue(2:q1)5:test11:k)0:)(4:post2:q1(9:subscribe0:5:test18:consumer5:test11:k)0:)\n"); fprintf(f, "(9:subscribe5:test%c0:0:5:test%c5:login)(4:post7:factory(6:create%d:%s(2:q1)5:test%c1:k)0:)(4:post2:q1(9:subscribe0:5:test%c8:consumer5:test%c1:k)0:)\n",
idchar, idchar, (int) strlen(qclass), qclass, idchar, idchar, idchar);
fflush(f); fflush(f);
while (1) { while (1) {