--- /dev/null
+ o Code simplifications and refactoring:
+ - Remove a bunch of unused function declarations as well as a block of
+ #if 0'd code from the unit tests. Closes bug 1824.
size_t buf_datalen(const buf_t *buf);
size_t buf_allocation(const buf_t *buf);
size_t buf_slack(const buf_t *buf);
-const char *_buf_peek_raw_buffer(const buf_t *buf);
int read_to_buf(int s, size_t at_most, buf_t *buf, int *reached_eof,
int *socket_error);
double quantile, double time_ms);
int circuit_build_times_update_alpha(circuit_build_times_t *cbt);
double circuit_build_times_cdf(circuit_build_times_t *cbt, double x);
-void circuit_build_times_add_timeout_worker(circuit_build_times_t *cbt,
- double quantile_cutoff);
void circuitbuild_running_unit_tests(void);
void circuit_build_times_reset(circuit_build_times_t *cbt);
int connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
origin_circuit_t *circ,
crypt_path_t *cpath);
-int hostname_is_noconnect_address(const char *address);
/** Possible return values for parse_extended_hostname. */
typedef enum hostname_type_t {
int connection_or_send_destroy(circid_t circ_id, or_connection_t *conn,
int reason);
int connection_or_send_netinfo(or_connection_t *conn);
-int connection_or_send_cert(or_connection_t *conn);
-int connection_or_send_link_auth(or_connection_t *conn);
-int connection_or_compute_link_auth_hmac(or_connection_t *conn,
- char *hmac_out);
int is_or_protocol_version_known(uint16_t version);
void cell_pack(packed_cell_t *dest, const cell_t *src);
enum was_router_added_t dirserv_add_descriptor(routerinfo_t *ri,
const char **msg,
const char *source);
-void dirserv_free_descriptors(void);
void dirserv_set_router_is_running(routerinfo_t *router, time_t now);
int list_server_status_v1(smartlist_t *routers, char **router_status_out,
int for_controller);
int getinfo_helper_accounting(control_connection_t *conn,
const char *question, char **answer,
const char **errmsg);
-void accounting_set_bandwidth_usage_from_state(or_state_t *state);
#endif
unsigned flags);
void networkstatus_note_certs_arrived(void);
void routers_update_all_from_networkstatus(time_t now, int dir_version);
-void routerstatus_list_update_from_consensus_networkstatus(time_t now);
void routers_update_status_from_consensus_networkstatus(smartlist_t *routers,
int reset_failures);
void signed_descs_update_status_from_consensus_networkstatus(
int num_rend_services(void);
int rend_config_services(or_options_t *options, int validate_only);
int rend_service_load_keys(void);
-void rend_services_init(void);
void rend_services_introduce(void);
void rend_consider_services_upload(time_t now);
void rend_hsdir_routers_changed(void);
void rep_hist_free_all(void);
-/* for hidden service usage statistics */
-void hs_usage_note_publish_total(const char *service_id, time_t now);
-void hs_usage_note_publish_novel(const char *service_id, time_t now);
-void hs_usage_note_fetch_total(const char *service_id, time_t now);
-void hs_usage_note_fetch_successful(const char *service_id, time_t now);
-void hs_usage_write_statistics_to_file(time_t now);
-void hs_usage_free_all(void);
-
void rep_hist_exit_stats_init(time_t now);
void rep_hist_reset_exit_stats(time_t now);
void rep_hist_exit_stats_term(void);
int is_extrainfo,
int allow_annotations,
const char *prepend_annotations);
-int router_parse_routerlist_from_directory(const char *s,
- routerlist_t **dest,
- crypto_pk_env_t *pkey,
- int check_version,
- int write_to_cache);
int router_parse_runningrouters(const char *str);
int router_parse_directory(const char *str);
buf_free(buf);
buf = NULL;
-#if 0
- {
- int s;
- int eof;
- int i;
- buf_t *buf2;
- /****
- * read_to_buf
- ****/
- s = open(get_fname("data"), O_WRONLY|O_CREAT|O_TRUNC, 0600);
- write(s, str, 256);
- close(s);
-
- s = open(get_fname("data"), O_RDONLY, 0);
- eof = 0;
- errno = 0; /* XXXX */
- i = read_to_buf(s, 10, buf, &eof);
- printf("%s\n", strerror(errno));
- test_eq(i, 10);
- test_eq(eof, 0);
- //test_eq(buf_capacity(buf), 4096);
- test_eq(buf_datalen(buf), 10);
-
- test_memeq(str, (char*)_buf_peek_raw_buffer(buf), 10);
-
- /* Test reading 0 bytes. */
- i = read_to_buf(s, 0, buf, &eof);
- //test_eq(buf_capacity(buf), 512*1024);
- test_eq(buf_datalen(buf), 10);
- test_eq(eof, 0);
- test_eq(i, 0);
-
- /* Now test when buffer is filled exactly. */
- buf2 = buf_new_with_capacity(6);
- i = read_to_buf(s, 6, buf2, &eof);
- //test_eq(buf_capacity(buf2), 6);
- test_eq(buf_datalen(buf2), 6);
- test_eq(eof, 0);
- test_eq(i, 6);
- test_memeq(str+10, (char*)_buf_peek_raw_buffer(buf2), 6);
- buf_free(buf2);
- buf2 = NULL;
-
- /* Now test when buffer is filled with more data to read. */
- buf2 = buf_new_with_capacity(32);
- i = read_to_buf(s, 128, buf2, &eof);
- //test_eq(buf_capacity(buf2), 128);
- test_eq(buf_datalen(buf2), 32);
- test_eq(eof, 0);
- test_eq(i, 32);
- buf_free(buf2);
- buf2 = NULL;
-
- /* Now read to eof. */
- test_assert(buf_capacity(buf) > 256);
- i = read_to_buf(s, 1024, buf, &eof);
- test_eq(i, (256-32-10-6));
- test_eq(buf_capacity(buf), MAX_BUF_SIZE);
- test_eq(buf_datalen(buf), 256-6-32);
- test_memeq(str, (char*)_buf_peek_raw_buffer(buf), 10); /* XXX Check rest. */
- test_eq(eof, 0);
-
- i = read_to_buf(s, 1024, buf, &eof);
- test_eq(i, 0);
- test_eq(buf_capacity(buf), MAX_BUF_SIZE);
- test_eq(buf_datalen(buf), 256-6-32);
- test_eq(eof, 1);
- }
-#endif
-
done:
if (buf)
buf_free(buf);