Changeset 357
- Timestamp:
- 31/08/07 02:24:28 (15 months ago)
- Location:
- trunk
- Files:
-
- 9 modified
-
c2s/c2s.c (modified) (4 diffs)
-
c2s/c2s.h (modified) (3 diffs)
-
c2s/main.c (modified) (4 diffs)
-
etc/c2s.xml.dist.in (modified) (1 diff)
-
etc/s2s.xml.dist.in (modified) (1 diff)
-
s2s/in.c (modified) (1 diff)
-
s2s/main.c (modified) (3 diffs)
-
s2s/out.c (modified) (1 diff)
-
s2s/s2s.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/c2s/c2s.c
r353 r357 210 210 /* we're counting packets */ 211 211 sess->packet_count++; 212 sess->c2s->packet_count++; 212 213 213 214 nad = (nad_t) data; … … 427 428 c2s_t c2s = (c2s_t) arg; 428 429 struct sockaddr_storage sa; 429 int namelen = sizeof(sa), port, nbytes ;430 int namelen = sizeof(sa), port, nbytes, flags = 0; 430 431 431 432 switch(a) { … … 504 505 xhash_put(c2s->sessions, sess->skey, (void *) sess); 505 506 507 flags = SX_SASL_OFFER; 506 508 #ifdef HAVE_SSL 507 509 /* go ssl wrappermode if they're on the ssl port */ 508 510 if(port == c2s->local_ssl_port) 509 sx_server_init(sess->s, SX_SSL_WRAPPER | SX_SASL_OFFER); 510 else 511 sx_server_init(sess->s, SX_SASL_OFFER); 512 #else 513 sx_server_init(sess->s, SX_SASL_OFFER); 511 flags |= SX_SSL_WRAPPER; 514 512 #endif 513 #ifdef HAVE_LIBZ 514 flags |= SX_COMPRESS_OFFER; 515 #endif 516 sx_server_init(sess->s, flags); 517 515 518 break; 516 519 } … … 1046 1049 } 1047 1050 1051 /* we're counting packets */ 1052 sess->packet_count++; 1053 sess->c2s->packet_count++; 1054 1048 1055 /* remove sm specifics */ 1049 1056 nad_set_attr(nad, 1, ns, "c2s", NULL, 0); -
trunk/c2s/c2s.h
r350 r357 28 28 #include "sx/sx.h" 29 29 #include "sx/ssl.h" 30 #include "sx/compress.h" 30 31 #ifdef HEADER_MD5_H 31 32 # define MD5_H … … 144 145 sx_plugin_t sx_ssl; 145 146 sx_plugin_t sx_sasl; 147 sx_plugin_t sx_compress; 146 148 147 149 /** router's conn */ … … 165 167 char *log_facility; 166 168 char *log_ident; 169 170 /** packet counter */ 171 long long int packet_count; 172 char *packet_stats; 167 173 168 174 /** connect retry */ -
trunk/c2s/main.c
r350 r357 113 113 c2s->log_ident = config_get_one(c2s->config, "log.file", 0); 114 114 115 c2s->packet_stats = config_get_one(c2s->config, "stats.packet", 0); 116 115 117 c2s->local_ip = config_get_one(c2s->config, "local.ip", 0); 116 118 if(c2s->local_ip == NULL) … … 495 497 sess_t sess; 496 498 union xhashv xhv; 497 #ifdef POOL_DEBUG 498 time_t pool_time = 0; 499 #endif 499 time_t check_time = 0; 500 500 501 501 #ifdef HAVE_UMASK … … 642 642 } 643 643 644 #ifdef HAVE_LIBZ 645 /* get compression up and running */ 646 c2s->sx_compress = sx_env_plugin(c2s->sx_env, sx_compress_init); 647 if(c2s->sx_compress == NULL) { 648 log_write(c2s->log, LOG_ERR, "failed to initialise compression"); 649 } 650 #endif 651 652 /* get bind up */ 644 653 sx_env_plugin(c2s->sx_env, bind_init, c2s); 645 654 … … 714 723 } 715 724 725 if(time(NULL) > check_time + 60) { 716 726 #ifdef POOL_DEBUG 717 if(time(NULL) > pool_time + 60) {718 727 pool_stat(1); 719 pool_time = time(NULL); 720 } 721 #endif 728 #endif 729 if(c2s->packet_stats != NULL) { 730 int fd = open(c2s->packet_stats, O_TRUNC | O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP); 731 if(fd) { 732 char buf[100]; 733 int len = snprintf(buf, 100, "%lld\n", c2s->packet_count); 734 write(fd, buf, len); 735 close(fd); 736 } else { 737 log_write(c2s->log, LOG_ERR, "failed to write packet statistics to: %s", c2s->packet_stats); 738 c2s_shutdown = 1; 739 } 740 } 741 742 check_time = time(NULL); 743 } 722 744 } 723 745 -
trunk/etc/c2s.xml.dist.in
r350 r357 264 264 </io> 265 265 266 <!-- Statistics --> 267 <stats> 268 <!-- file containing count of packets that went through --> 269 <!-- 270 <packet>@localstatedir@/jabberd/stats/c2s.packets</packet> 271 --> 272 </stats> 273 266 274 <!-- Authentication/registration database configuration --> 267 275 <authreg> -
trunk/etc/s2s.xml.dist.in
r162 r357 166 166 </check> 167 167 168 <!-- Statistics --> 169 <stats> 170 <!-- file containing count of packets that went through --> 171 <!-- 172 <packet>@localstatedir@/jabberd/stats/s2s.packets</packet> 173 --> 174 </stats> 175 168 176 </s2s> -
trunk/s2s/in.c
r311 r357 257 257 /* we're counting packets */ 258 258 in->packet_count++; 259 in->s2s->packet_count++; 259 260 260 261 nad = (nad_t) data; -
trunk/s2s/main.c
r235 r357 110 110 s2s->log_ident = config_get_one(s2s->config, "log.file", 0); 111 111 112 s2s->packet_stats = config_get_one(s2s->config, "stats.packet", 0); 113 112 114 s2s->local_ip = config_get_one(s2s->config, "local.ip", 0); 113 115 if(s2s->local_ip == NULL) … … 381 383 dnscache_t dns; 382 384 union xhashv xhv; 383 #ifdef POOL_DEBUG 384 time_t pool_time = 0; 385 #endif 385 time_t check_time = 0; 386 386 387 387 #ifdef HAVE_UMASK … … 578 578 } 579 579 580 if(time(NULL) > check_time + 60) { 580 581 #ifdef POOL_DEBUG 581 if(time(NULL) > pool_time + 60) {582 582 pool_stat(1); 583 pool_time = time(NULL); 584 } 585 #endif 583 #endif 584 if(s2s->packet_stats != NULL) { 585 int fd = open(s2s->packet_stats, O_TRUNC | O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP); 586 if(fd) { 587 char buf[100]; 588 int len = snprintf(buf, 100, "%lld\n", s2s->packet_count); 589 write(fd, buf, len); 590 close(fd); 591 } else { 592 log_write(s2s->log, LOG_ERR, "failed to write packet statistics to: %s", s2s->packet_stats); 593 s2s_shutdown = 1; 594 } 595 } 596 597 check_time = time(NULL); 598 } 586 599 } 587 600 -
trunk/s2s/out.c
r285 r357 633 633 /* we're counting packets */ 634 634 out->packet_count++; 635 out->s2s->packet_count++; 635 636 636 637 nad = (nad_t) data; -
trunk/s2s/s2s.h
r285 r357 83 83 char *log_ident; 84 84 85 /** packet counter */ 86 long long int packet_count; 87 char *packet_stats; 88 85 89 /** connect retry */ 86 90 int retry_init;
