Whitespace fixes

dynamic-accesslists
erdgeist 16 years ago
parent 55d03b9a1b
commit daaee855b2

@ -220,7 +220,7 @@ static void server_mainloop( ) {
}
livesync_ticker();
/* See if we need to move our pools */
if( NOW != ot_last_clean_time ) {
ot_last_clean_time = NOW;
@ -254,10 +254,10 @@ static int64_t ot_try_bind( char ip[4], uint16_t port, PROTO_FLAG proto ) {
io_wantread( s );
#ifdef _DEBUG
#ifdef _DEBUG
fputs( " success.\n", stderr);
#endif
return s;
}
@ -291,19 +291,19 @@ int parse_configfile( char * config_filename ) {
int bound = 0;
accesslist_filehandle = fopen( config_filename, "r" );
if( accesslist_filehandle == NULL ) {
fprintf( stderr, "Warning: Can't open config file: %s.", config_filename );
return 0;
}
while( fgets( inbuf, sizeof(inbuf), accesslist_filehandle ) ) {
char *newl;
char *p = inbuf;
/* Skip white spaces */
while(isspace(*p)) ++p;
/* Ignore comments and empty lines */
if((*p=='#')||(*p=='\n')||(*p==0)) continue;
@ -360,7 +360,7 @@ int parse_configfile( char * config_filename ) {
fprintf( stderr, "Unhandled line in config file: %s\n", inbuf );
continue;
parse_error:
fprintf( stderr, "Parse error in config file: %s\n", inbuf);
fprintf( stderr, "Parse error in config file: %s\n", inbuf);
}
fclose( accesslist_filehandle );
return bound;
@ -371,7 +371,7 @@ int main( int argc, char **argv ) {
char serverip[4] = {0,0,0,0}, tmpip[4];
int bound = 0, scanon = 1;
uint16_t tmpport;
while( scanon ) {
switch( getopt( argc, argv, ":i:p:A:P:d:r:s:f:v"
#ifdef WANT_ACCESSLIST_BLACK

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __OT_ACCESSLIST_H__

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __OT_CLEAN_H__

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifdef WANT_FULLSCRAPE

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __OT_FULLSCRAPE_H__

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
@ -335,7 +335,7 @@ static ssize_t http_handle_stats( const int64 client_socket, char *data, char *d
stats_deliver( client_socket, mode );
return -2;
}
/* Simple stats can be answerred immediately */
if( !( l = return_stats_for_tracker( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH, mode, 0 ) ) ) HTTPERROR_500;

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __OT_HTTP_H__

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
@ -24,7 +24,7 @@ void *iovec_increase( int *iovec_entries, struct iovec **iovector, size_t new_al
if( !new_ptr )
return NULL;
((*iovector)[*iovec_entries]).iov_base = new_ptr;
((*iovector)[*iovec_entries]).iov_len = new_alloc;
((*iovector)[*iovec_entries]).iov_len = new_alloc;
++*iovec_entries;
return new_ptr;
}

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __OT_IOVEC_H__

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
@ -54,7 +54,7 @@ void livesync_init( ) {
pthread_create( &thread_id, NULL, livesync_worker, NULL );
}
void livesync_deinit() {
pthread_cancel( thread_id );
}
@ -106,7 +106,7 @@ void livesync_tell( ot_hash * const info_hash, const ot_peer * const peer, const
stuck when there's not enough traffic to fill udp packets fast
enough */
void livesync_ticker( ) {
if( ( g_now - livesync_lastpacket_time > LIVESYNC_MAXDELAY) &&
if( ( g_now - livesync_lastpacket_time > LIVESYNC_MAXDELAY) &&
( livesync_outbuffer_pos > livesync_outbuffer_start + sizeof( g_tracker_id ) ) )
livesync_issuepacket();
}
@ -115,7 +115,7 @@ static void * livesync_worker( void * args ) {
uint8_t in_ip[4]; uint16_t in_port;
ssize_t datalen;
int off;
args = args;
while( 1 ) {

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __OT_LIVESYNC_H__
@ -24,7 +24,7 @@
0x001c 0x02 peer's port
0x0020 0x02 peer flags v1 ( SEEDING = 0x80, COMPLETE = 0x40, STOPPED = 0x20 )
]*
For N == 24: (aggregator syncs)
0x0000 0x04 id of tracker instance
[ 0x0004 0x14 info_hash
@ -34,7 +34,7 @@
0x0021 0x02 peer flags v1 ( SEEDING = 0x80, COMPLETE = 0x40, STOPPED = 0x20 )
]+
]*
*/
@ -61,7 +61,7 @@ void handle_livesync( const int64 serversocket );
#else
/* If no syncing is required, save calling code from #ifdef
/* If no syncing is required, save calling code from #ifdef
constructions */
#define livesync_init()

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
@ -93,7 +93,7 @@ void mutex_bucket_unlock( int bucket ) {
bucket_remove( bucket );
pthread_cond_broadcast( &bucket_being_unlocked );
pthread_mutex_unlock( &bucket_mutex );
}
}
void mutex_bucket_unlock_by_hash( ot_hash *hash ) {
unsigned char *local_hash = hash[0];
@ -134,7 +134,7 @@ int mutex_workqueue_pushtask( int64 socket, ot_tasktype tasktype ) {
}
/* Skip to end of list */
tmptask = &tasklist;
tmptask = &tasklist;
while( *tmptask )
tmptask = &(*tmptask)->next;
*tmptask = task;
@ -267,7 +267,7 @@ int mutex_workqueue_pushresult( ot_taskid taskid, int iovec_entries, struct iove
MTX_DBG( "pushresult unlocks.\n" );
pthread_mutex_unlock( &tasklist_mutex );
MTX_DBG( "pushresult unlocked.\n" );
/* Indicate whether the worker has to throw away results */
return task ? 0 : -1;
}
@ -291,7 +291,7 @@ int64 mutex_workqueue_popresult( int *iovec_entries, struct iovec ** iovec ) {
*iovec_entries = (*task)->iovec_entries;
*iovec = (*task)->iovec;
socket = (*task)->socket;
*task = (*task)->next;
free( ptask );
}

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __OT_MUTEX_H__

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
@ -85,7 +85,7 @@ static int stats_shift_down_network_count( stats_network_node **node, int depth,
int i, rest = 0;
if( !*node ) return 0;
if( ++depth == STATS_NETWORK_NODE_MAXDEPTH )
if( ++depth == STATS_NETWORK_NODE_MAXDEPTH )
for( i=0; i<STATS_NETWORK_NODE_COUNT; ++i ) {
rest += ((*node)->counters[i]>>=shift);
return rest;
@ -487,7 +487,7 @@ static size_t stats_torrents_mrtg( char * reply )
static size_t stats_httperrors_txt ( char * reply ) {
return sprintf( reply, "302 RED %llu\n400 ... %llu\n400 PAR %llu\n400 COM %llu\n403 IP %llu\n404 INV %llu\n500 SRV %llu\n",
ot_failed_request_counts[0], ot_failed_request_counts[1], ot_failed_request_counts[2],
ot_failed_request_counts[0], ot_failed_request_counts[1], ot_failed_request_counts[2],
ot_failed_request_counts[3], ot_failed_request_counts[4], ot_failed_request_counts[5],
ot_failed_request_counts[6] );
}
@ -545,10 +545,10 @@ static void stats_make( int *iovec_entries, struct iovec **iovector, ot_tasktype
*iovector = NULL;
if( !( r = iovec_increase( iovec_entries, iovector, OT_STATS_TMPSIZE ) ) )
return;
switch( mode & TASK_TASK_MASK ) {
case TASK_STATS_TORRENTS: r += stats_torrents_mrtg( r ); break;
case TASK_STATS_PEERS: r += stats_peers_mrtg( r ); break;
case TASK_STATS_PEERS: r += stats_peers_mrtg( r ); break;
case TASK_STATS_SLASH24S: r += stats_slash24s_txt( r, 25, 16 ); break;
case TASK_STATS_TOP10: r += stats_top10_txt( r ); break;
case TASK_STATS_MEMORY: r += stats_vector_usage( r ); break;
@ -609,9 +609,9 @@ void stats_issue_event( ot_status_event event, PROTO_FLAG proto, uint32_t event_
static void * stats_worker( void * args ) {
int iovec_entries;
struct iovec *iovector;
args = args;
while( 1 ) {
ot_tasktype tasktype = TASK_STATS;
ot_taskid taskid = mutex_workqueue_poptask( &tasktype );

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __OT_STATS_H__
@ -30,7 +30,7 @@ enum {
CODE_HTTPERROR_403_IP,
CODE_HTTPERROR_404,
CODE_HTTPERROR_500,
CODE_HTTPERROR_COUNT
};

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __OT_SYNC_H__

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __OT_UDP_H__

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __OT_VECTOR_H__

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#include "scan.h"

@ -1,8 +1,8 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __SCAN_URLENCODED_QUERY_H__
#define __SCAN_URLENCODED_QUERY_H__

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
@ -277,7 +277,7 @@ size_t remove_peer_from_torrent( ot_hash *hash, ot_peer *peer, char *reply, PROT
ot_torrent *torrent = binary_search( hash, torrents_list->data, torrents_list->size, sizeof( ot_torrent ), OT_HASH_COMPARE_SIZE, &exactmatch );
ot_peerlist *peer_list;
#ifdef WANT_SYNC_LIVE
#ifdef WANT_SYNC_LIVE
if( proto != FLAG_MCA )
livesync_tell( hash, peer, PEER_FLAG_STOPPED );
#endif
@ -294,7 +294,7 @@ size_t remove_peer_from_torrent( ot_hash *hash, ot_peer *peer, char *reply, PROT
((uint32_t*)reply)[3] = ((uint32_t*)reply)[4] = 0;
return (size_t)20;
}
if( proto == FLAG_MCA )
return 0;
}
@ -343,7 +343,7 @@ int trackerlogic_init( const char * const serverdir ) {
srandom( time(NULL) );
g_tracker_id = random();
/* Initialise background worker threads */
mutex_init( );
clean_init( );

@ -1,6 +1,6 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef __OT_TRACKERLOGIC_H__

Loading…
Cancel
Save