Browse Source

clang-format

master
Dirk Engling 2 months ago
parent
commit
7a48a69345
  1. 38
      ot_sync.c

38
ot_sync.c

@ -4,24 +4,24 @@ @@ -4,24 +4,24 @@
$id$ */
/* System */
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/uio.h>
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/uio.h>
/* Libowfat */
#include "scan.h"
#include "byte.h"
#include "io.h"
#include "scan.h"
/* Opentracker */
#include "trackerlogic.h"
#include "ot_iovec.h"
#include "ot_mutex.h"
#include "ot_sync.h"
#include "ot_stats.h"
#include "ot_iovec.h"
#include "ot_sync.h"
#include "trackerlogic.h"
#ifdef WANT_SYNC_BATCH
@ -38,7 +38,8 @@ int add_changeset_to_tracker( uint8_t *data, size_t len ) { @@ -38,7 +38,8 @@ int add_changeset_to_tracker( uint8_t *data, size_t len ) {
/* We do know, that the string is \n terminated, so it cant
overflow */
if( byte_diff( data, 8, "d4:syncd" ) ) return -1;
if (byte_diff(data, 8, "d4:syncd"))
return -1;
data += 8;
while (1) {
@ -61,7 +62,8 @@ int add_changeset_to_tracker( uint8_t *data, size_t len ) { @@ -61,7 +62,8 @@ int add_changeset_to_tracker( uint8_t *data, size_t len ) {
while (peer_count > 0) {
add_peer_to_torrent(hash, (ot_peer *)data, 1);
data += 8; peer_count -= 8;
data += 8;
peer_count -= 8;
}
}
return 0;
@ -84,7 +86,8 @@ static void sync_make( int *iovec_entries, struct iovec **iovector ) { @@ -84,7 +86,8 @@ static void sync_make( int *iovec_entries, struct iovec **iovector ) {
This works as a low watermark */
re = r + OT_SYNC_CHUNK_SIZE;
memmove( r, "d4:syncd", 8 ); r += 8;
memmove(r, "d4:syncd", 8);
r += 8;
/* For each bucket... */
for (bucket = 0; bucket < OT_BUCKET_COUNT; ++bucket) {
@ -111,10 +114,14 @@ static void sync_make( int *iovec_entries, struct iovec **iovector ) { @@ -111,10 +114,14 @@ static void sync_make( int *iovec_entries, struct iovec **iovector ) {
re = r + OT_SYNC_CHUNK_SIZE;
}
*r++ = '2'; *r++ = '0'; *r++ = ':';
memmove( r, hash, sizeof( ot_hash ) ); r += sizeof( ot_hash );
*r++ = '2';
*r++ = '0';
*r++ = ':';
memmove(r, hash, sizeof(ot_hash));
r += sizeof(ot_hash);
r += sprintf(r, "%zd:", byte_count);
memmove( r, peer_list->changeset.data, byte_count ); r += byte_count;
memmove(r, peer_list->changeset.data, byte_count);
r += byte_count;
}
/* All torrents done: release lock on currenct bucket */
@ -122,7 +129,8 @@ static void sync_make( int *iovec_entries, struct iovec **iovector ) { @@ -122,7 +129,8 @@ static void sync_make( int *iovec_entries, struct iovec **iovector ) {
}
/* Close bencoded sync dictionary */
*r++='e'; *r++='e';
*r++ = 'e';
*r++ = 'e';
/* Release unused memory in current output buffer */
iovec_fixlast(iovec_entries, iovector, r);

Loading…
Cancel
Save