diff options
author | erdgeist <> | 2009-01-02 08:57:53 +0000 |
---|---|---|
committer | erdgeist <> | 2009-01-02 08:57:53 +0000 |
commit | 2df09905f5540fee096d48a92cb0c42558498a12 (patch) | |
tree | 68eab61d29719400972485de395dd0465467aea6 /trackerlogic.h | |
parent | 548e2b8338b5ee8d24fa928e833f345bb5cb6f0e (diff) |
* opentracker now drops permissions in correct order and really chroots() if ran as root
* lock passing between add_peer_to_torrent and return_peers_for_torrent is now avoided by providing a more general add_peer_to_torrent_and_return_peers function that can be used with NULL parameters to not return any peers (in sync case)
* in order to keep a fast overview how many torrents opentracker maintains, every mutex_bucket_unlock operation expects an additional integer parameter that tells ot_mutex.c how many torrents have been added or removed. A function mutex_get_torrent_count has been introduced.
Diffstat (limited to 'trackerlogic.h')
-rw-r--r-- | trackerlogic.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/trackerlogic.h b/trackerlogic.h index 75e98d2..34cee3b 100644 --- a/trackerlogic.h +++ b/trackerlogic.h | |||
@@ -73,7 +73,6 @@ static const uint8_t PEER_FLAG_LEECHING = 0x00; | |||
73 | #define OT_PEERFLAG(peer) (((uint8_t*)(peer))[6]) | 73 | #define OT_PEERFLAG(peer) (((uint8_t*)(peer))[6]) |
74 | #define OT_PEERTIME(peer) (((uint8_t*)(peer))[7]) | 74 | #define OT_PEERTIME(peer) (((uint8_t*)(peer))[7]) |
75 | 75 | ||
76 | #define OT_PEER_COMPARE_SIZE ((size_t)6) | ||
77 | #define OT_HASH_COMPARE_SIZE (sizeof(ot_hash)) | 76 | #define OT_HASH_COMPARE_SIZE (sizeof(ot_hash)) |
78 | 77 | ||
79 | struct ot_peerlist; | 78 | struct ot_peerlist; |
@@ -111,17 +110,17 @@ struct ot_peerlist { | |||
111 | #define WANT_SYNC_PARAM( param ) | 110 | #define WANT_SYNC_PARAM( param ) |
112 | #endif | 111 | #endif |
113 | 112 | ||
114 | int trackerlogic_init( const char * const serverdir ); | 113 | void trackerlogic_init( ); |
115 | void trackerlogic_deinit( void ); | 114 | void trackerlogic_deinit( void ); |
116 | void exerr( char * message ); | 115 | void exerr( char * message ); |
117 | 116 | ||
118 | /* add_peer_to_torrent does only release the torrent bucket if from_sync is set, | 117 | /* add_peer_to_torrent does only release the torrent bucket if from_sync is set, |
119 | otherwise it is released in return_peers_for_torrent */ | 118 | otherwise it is released in return_peers_for_torrent */ |
120 | size_t return_peers_for_torrent( ot_torrent *torrent, size_t amount, char *reply, PROTO_FLAG proto ); | 119 | #define add_peer_to_torrent(hash,peer,proto) add_peer_to_torrent_and_return_peers(hash,peer,proto,0,NULL) |
121 | ot_torrent *add_peer_to_torrent( ot_hash *hash, ot_peer *peer WANT_SYNC_PARAM( int from_sync ) ); | 120 | size_t add_peer_to_torrent_and_return_peers( ot_hash *hash, ot_peer *peer, PROTO_FLAG proto, size_t amount, char * reply ); |
122 | size_t remove_peer_from_torrent( ot_hash *hash, ot_peer *peer, char *reply, PROTO_FLAG proto ); | 121 | size_t remove_peer_from_torrent( ot_hash *hash, ot_peer *peer, char *reply, PROTO_FLAG proto ); |
123 | size_t return_tcp_scrape_for_torrent( ot_hash *hash, int amount, char *reply ); | 122 | size_t return_tcp_scrape_for_torrent( ot_hash *hash, int amount, char *reply ); |
124 | size_t return_udp_scrape_for_torrent( ot_hash *hash, char *reply ); | 123 | size_t return_udp_scrape_for_torrent( ot_hash *hash, char *reply ); |
125 | 124 | ||
126 | /* Helper, before it moves to its own object */ | 125 | /* Helper, before it moves to its own object */ |
127 | void free_peerlist( ot_peerlist *peer_list ); | 126 | void free_peerlist( ot_peerlist *peer_list ); |