1 diff -burN bw_mod-0.6.orig/bw_mod-0.6.c bw_mod-0.6/bw_mod-0.6.c
2 --- bw_mod-0.6.orig/bw_mod-0.6.c 2005-03-12 14:28:51.665241352 +0100
3 +++ bw_mod-0.6/bw_mod-0.6.c 2005-03-12 14:32:46.305570600 +0100
5 nowtime = apr_time_now();
6 if ( bwstat->time < (nowtime - 1000000) ) {
7 /* And if we got lock */
8 - if ( apr_atomic_cas( &bwstat->lock, 1, 0 ) == 0 ) {
9 + if ( apr_atomic_cas32( &bwstat->lock, 1, 0 ) == 0 ) {
11 /* Calculate bw used in the last timeinterval */
12 bwstat->bandwidth = ( bwstat->bytes_count / (double)(nowtime - bwstat->time)) * 1000000 ;
14 bwstat->time = apr_time_now();
17 - apr_atomic_set( &bwstat->lock, 0 );
18 + apr_atomic_set32( &bwstat->lock, 0 );
23 else bwmaxconn = bwstat;
25 /* Add 1 active connection to the record */
26 - apr_atomic_inc( &bwmaxconn->connection_count );
27 + apr_atomic_inc32( &bwmaxconn->connection_count );
30 if (sconf->debug == BANDWIDTH_ENABLED) {
32 ap_pass_brigade(f->next, ctx->bb);
34 /* Delete 1 active connection */
35 - apr_atomic_dec( &bwmaxconn->connection_count );
36 + apr_atomic_dec32( &bwmaxconn->connection_count );
41 b = APR_BRIGADE_FIRST(bb);
43 /* Add the number of bytes transferred, so we can get an estimated bw usage */
44 - apr_atomic_add( &bwstat->bytes_count, packet);
45 + apr_atomic_add32( &bwstat->bytes_count, packet);
47 /* If the connection goes to hell... go with it ! */
48 if (r->connection->aborted) {
49 /* Verbose. Tells when the connection was ended */
50 if (sconf->debug == BANDWIDTH_ENABLED)
51 ap_log_error(APLOG_MARK, APLOG_NOTICE|APLOG_NOERRNO, 0,NULL,"[W] Connection to hell");
52 - apr_atomic_dec( &bwmaxconn->connection_count );
53 + apr_atomic_dec32( &bwmaxconn->connection_count );
58 b = APR_BRIGADE_FIRST(bb);
60 /* Add the number of bytes to the counter */
61 - apr_atomic_add( &bwstat->bytes_count, bytes);
62 + apr_atomic_add32( &bwstat->bytes_count, bytes);
64 /* Pass the final brigade */
65 ap_pass_brigade(f->next, ctx->bb);
68 /* Delete 1 active connection to the record */
69 - apr_atomic_dec( &bwmaxconn->connection_count );
70 + apr_atomic_dec32( &bwmaxconn->connection_count );
72 /* Verbose, tells when we ended the Filter */
73 if (sconf->debug == BANDWIDTH_ENABLED)