From 779d6c235ff8fe5284fd10dc82a9b99e7fa38d06 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Mon, 5 Jan 2009 18:05:39 +0000 Subject: * http and udp routines now use thread local buffers passed in workstruct containers. In other words they do not use static_buffer anymore and are considered to be thread safe. * the new workstruct also introduces a well defined buffer and result passing path * a new function scan_find_keywords is a wrapper around scan_urlencoded_query that maps keys in url to values passed in an array of ot_keywords structs * this new function cleans up much of url parameter parsing work, where read_ptr and write_ptr have been introduced rather than the confusing char *c, *data variables * I now use memcmp instead of byte_diff to allow compiler to optimize constant size string compares * got rid of UTORRENT_1600_WORKAROUND * livesync_ticker is now only called from one (currently main) thread to avoid race conditions --- trackerlogic.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'trackerlogic.h') diff --git a/trackerlogic.h b/trackerlogic.h index 34cee3b..eb2906b 100644 --- a/trackerlogic.h +++ b/trackerlogic.h @@ -96,6 +96,31 @@ struct ot_peerlist { }; #define OT_PEERLIST_HASBUCKETS(peer_list) ((peer_list) && ((peer_list)->peers.size > (peer_list)->peers.space)) +struct ot_workstruct { + /* Thread specific, static */ +#define THREAD_INBUF_SIZE 8192 + char *inbuf; + size_t inbuf_size; +#define THREAD_OUTBUF_SIZE 8192 + char *outbuf; + size_t outbuf_size; +#ifdef _DEBUG_HTTPERROR +#define THREAD_DEBUGBUF_SIZE 8192 + char *debugbuf; + size_t debugbuf_size; +#endif + + /* HTTP specific, non static */ + char *request; + ssize_t request_size; + char *reply; + ssize_t reply_size; +#ifdef _DEBUG_PEERID + char *peer_id; + ssize_t peer_id_size; +#endif +}; + /* Exported functions */ -- cgit v1.2.3