Changeset 4426
- Timestamp:
- 01/25/07 15:46:44 (2 years ago)
- Files:
-
- wired/trunk/wired/accounts.c (modified) (6 diffs)
- wired/trunk/wired/banlist.c (modified) (1 diff)
- wired/trunk/wired/clients.h (modified) (2 diffs)
- wired/trunk/wired/commands.c (modified) (9 diffs)
- wired/trunk/wired/files.c (modified) (18 diffs)
- wired/trunk/wired/files.h (modified) (1 diff)
- wired/trunk/wired/main.c (modified) (2 diffs)
- wired/trunk/wired/main.h (modified) (1 diff)
- wired/trunk/wired/news.c (modified) (1 diff)
- wired/trunk/wired/server.c (modified) (2 diffs)
- wired/trunk/wired/settings.h (modified) (3 diffs)
- wired/trunk/wired/trackers.c (modified) (3 diffs)
- wired/trunk/wired/transfers.c (modified) (14 diffs)
- wired/trunk/wired/transfers.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wired/trunk/wired/accounts.c
r4403 r4426 48 48 49 49 50 static int_wd_accounts_delete_from_file(wi_file_t *, wi_string_t *);50 static wi_boolean_t _wd_accounts_delete_from_file(wi_file_t *, wi_string_t *); 51 51 static void _wd_accounts_reload_user(wi_string_t *); 52 52 static void _wd_accounts_reload_group(wi_string_t *); … … 521 521 #pragma mark - 522 522 523 static int _wd_accounts_delete_from_file(wi_file_t *file, wi_string_t *name) {523 static wi_boolean_t _wd_accounts_delete_from_file(wi_file_t *file, wi_string_t *name) { 524 524 wi_file_t *tmpfile; 525 525 wi_array_t *array; … … 746 746 wi_file_t *file; 747 747 wi_string_t *string; 748 uint32_tindex;748 wi_uinteger_t index; 749 749 750 750 wi_lock_lock(wd_users_lock); … … 779 779 wi_file_t *file; 780 780 wi_string_t *string; 781 uint32_tindex;781 wi_uinteger_t index; 782 782 783 783 wi_lock_lock(wd_groups_lock); … … 818 818 819 819 wd_account_t * wd_account_init_user_with_array(wd_account_t *account, wi_array_t *array) { 820 uint32_t count;820 wi_uinteger_t count; 821 821 822 822 count = wi_array_count(array); … … 855 855 856 856 wd_account_t * wd_account_init_group_with_array(wd_account_t *account, wi_array_t *array) { 857 uint32_t count;857 wi_uinteger_t count; 858 858 859 859 count = wi_array_count(array); wired/trunk/wired/banlist.c
r4403 r4426 90 90 wd_tempban_t *tempban; 91 91 wi_time_interval_t interval; 92 uint32_ti, count;92 wi_uinteger_t i, count; 93 93 94 94 count = wi_array_count(wd_tempbans); wired/trunk/wired/clients.h
r4403 r4426 71 71 wi_string_t *ip; 72 72 wi_string_t *host; 73 uint32_tport;73 wi_uinteger_t port; 74 74 wi_string_t *version; 75 75 wi_string_t *status; … … 78 78 79 79 char *buffer; 80 uint32_tbuffer_size;81 uint32_tbuffer_offset;80 wi_uinteger_t buffer_size; 81 wi_uinteger_t buffer_offset; 82 82 83 83 wi_time_interval_t login_time; wired/trunk/wired/commands.c
r4403 r4426 55 55 56 56 /* minimum number of arguments required */ 57 uint32_targs;57 wi_uinteger_t args; 58 58 59 59 /* activates idle clients? */ … … 66 66 67 67 static void wd_parse_command(wi_string_t *); 68 static uint32_twd_command_index(wi_string_t *);68 static wi_uinteger_t wd_command_index(wi_string_t *); 69 69 70 70 static void wd_cmd_ban(wi_array_t *); … … 219 219 220 220 void wd_control_thread(wi_runtime_instance_t *argument) { 221 wi_pool_t *pool;222 wd_client_t *client = argument;223 wi_string_t *string;224 uint32_t i = 0;225 int state;221 wi_pool_t *pool; 222 wd_client_t *client = argument; 223 wi_string_t *string; 224 wi_socket_state_t state; 225 wi_uinteger_t i = 0; 226 226 227 227 pool = wi_pool_init(wi_pool_alloc()); … … 237 237 do { 238 238 state = wi_socket_wait(client->socket, 0.1); 239 } while(state == 0&& client->state <= WD_CLIENT_STATE_LOGGED_IN);239 } while(state == WI_SOCKET_TIMEOUT && client->state <= WD_CLIENT_STATE_LOGGED_IN); 240 240 241 241 if(client->state > WD_CLIENT_STATE_LOGGED_IN) { … … 244 244 } 245 245 246 if(state < 0) {246 if(state == WI_SOCKET_ERROR) { 247 247 if(wi_error_code() == EINTR) { 248 248 /* got a signal */ … … 308 308 wi_array_t *arguments; 309 309 wi_string_t *command; 310 uint32_tindex;310 wi_uinteger_t index; 311 311 312 312 wi_parse_wired_command(buffer, &command, &arguments); … … 344 344 345 345 346 static uint32_twd_command_index(wi_string_t *command) {346 static wi_uinteger_t wd_command_index(wi_string_t *command) { 347 347 const char *cstring; 348 uint32_ti, min, max;349 int 32_tcmp;348 wi_uinteger_t i, min, max; 349 int cmp; 350 350 351 351 cstring = wi_string_cstring(command); … … 1242 1242 wd_chat_t *chat; 1243 1243 wd_cid_t cid; 1244 uint32_ti, count;1244 wi_uinteger_t i, count; 1245 1245 1246 1246 cid = wi_string_uint32(WI_ARRAY(arguments, 0)); … … 1585 1585 wd_chat_t *chat; 1586 1586 wd_cid_t cid; 1587 uint32_ti, count;1587 wi_uinteger_t i, count; 1588 1588 1589 1589 cid = wi_string_uint32(WI_ARRAY(arguments, 0)); wired/trunk/wired/files.c
r4403 r4426 81 81 static wi_rwlock_t *wd_files_index_lock; 82 82 static wi_lock_t *wd_files_indexer_lock; 83 static uint32_twd_files_index_level;83 static wi_uinteger_t wd_files_index_level; 84 84 static wi_set_t *wd_files_index_set; 85 85 86 uint32_twd_files_count, wd_files_unique_count;87 uint32_twd_directories_count, wd_directories_unique_count;86 wi_uinteger_t wd_files_count, wd_files_unique_count; 87 wi_uinteger_t wd_directories_count, wd_directories_unique_count; 88 88 wi_file_offset_t wd_files_size, wd_files_unique_size; 89 89 … … 122 122 wd_files_fts_action_t action; 123 123 struct stat sb; 124 uint32_tpathlength;125 int err ;124 wi_uinteger_t pathlength; 125 int error; 126 126 wi_boolean_t root, upload; 127 127 … … 146 146 wd_reply_error(); 147 147 148 goto err ;148 goto error; 149 149 } 150 150 … … 156 156 while((p = wi_fts_read(fts))) { 157 157 /* skip item? */ 158 action = wd_files_fts_action(p, &err );158 action = wd_files_fts_action(p, &error); 159 159 160 160 switch(action) { … … 174 174 case WD_FILES_FTS_ERROR: 175 175 wi_log_warn(WI_STR("Could not list %s: %s"), 176 p->fts_path, strerror(err ));176 p->fts_path, strerror(error)); 177 177 178 178 continue; … … 266 266 available); 267 267 268 err :268 error: 269 269 if(fts) 270 270 wi_fts_close(fts); … … 278 278 wi_file_offset_t count = 0; 279 279 wd_files_fts_action_t action; 280 int err ;280 int error; 281 281 282 282 fts = wd_files_fts_open(path); … … 292 292 while((p = wi_fts_read(fts))) { 293 293 /* skip item? */ 294 action = wd_files_fts_action(p, &err );294 action = wd_files_fts_action(p, &error); 295 295 296 296 switch(action) { … … 534 534 wd_file_type_t type; 535 535 struct stat sb; 536 uint32_tpathlength;537 int err ;536 wi_uinteger_t pathlength; 537 int error; 538 538 wi_boolean_t alias, recurse; 539 539 … … 557 557 while((p = wi_fts_read(fts))) { 558 558 /* skip item? */ 559 action = wd_files_fts_action(p, &err );559 action = wd_files_fts_action(p, &error); 560 560 561 561 switch(action) { … … 575 575 case WD_FILES_FTS_ERROR: 576 576 wi_log_warn(WI_STR("Could not search %s: %s"), 577 p->fts_path, strerror(err ));577 p->fts_path, strerror(error)); 578 578 579 579 continue; … … 662 662 wi_string_t *string; 663 663 wi_range_t range; 664 uint32_ti = 0, pathlength, index;664 wi_uinteger_t i = 0, pathlength, index; 665 665 666 666 wi_rwlock_rdlock(wd_files_index_lock); … … 757 757 wi_string_t *path, *realpath; 758 758 wi_time_interval_t interval; 759 uint32_tcount, capacity;759 wi_uinteger_t count, capacity; 760 760 761 761 pool = wi_pool_init(wi_pool_alloc()); … … 839 839 wd_files_fts_action_t action; 840 840 struct stat sb; 841 int err ;842 uint32_ti = 0, pathlength;841 int error; 842 wi_uinteger_t i = 0, pathlength; 843 843 wi_boolean_t alias, recurse; 844 844 … … 871 871 872 872 /* skip item? */ 873 action = wd_files_fts_action(p, &err );873 action = wd_files_fts_action(p, &error); 874 874 875 875 switch(action) { … … 889 889 case WD_FILES_FTS_ERROR: 890 890 wi_log_warn(WI_STR("Skipping index of %s: %s"), 891 p->fts_path, strerror(err ));891 p->fts_path, strerror(error)); 892 892 893 893 continue; … … 1099 1099 wi_string_t *name, *dirpath, *realdirpath, *metapath, *commentpath; 1100 1100 wi_string_t *string, *eachname, *eachcomment; 1101 uint32_tcomments = 0;1101 wi_uinteger_t comments = 0; 1102 1102 1103 1103 name = wi_string_last_path_component(path); … … 1232 1232 wi_array_t *array; 1233 1233 wd_file_type_t type; 1234 uint32_ti, count;1234 wi_uinteger_t i, count; 1235 1235 wi_boolean_t result = false; 1236 1236 wired/trunk/wired/files.h
r4403 r4426 75 75 76 76 77 extern uint32_twd_files_count, wd_files_unique_count;78 extern uint32_twd_folders_count, wd_folders_unique_count;77 extern wi_uinteger_t wd_files_count, wd_files_unique_count; 78 extern wi_uinteger_t wd_folders_count, wd_folders_unique_count; 79 79 extern wi_file_offset_t wd_files_size, wd_files_unique_size; 80 80 wired/trunk/wired/main.c
r4403 r4426 73 73 wi_lock_t *wd_status_lock; 74 74 wi_date_t *wd_start_date; 75 uint32_twd_current_users, wd_total_users;76 uint32_twd_current_downloads, wd_total_downloads;77 uint32_twd_current_uploads, wd_total_uploads;75 wi_uinteger_t wd_current_users, wd_total_users; 76 wi_uinteger_t wd_current_downloads, wd_total_downloads; 77 wi_uinteger_t wd_current_uploads, wd_total_uploads; 78 78 wi_file_offset_t wd_downloads_traffic, wd_uploads_traffic; 79 79 … … 419 419 void wd_signal_thread(wi_runtime_instance_t *arg) { 420 420 wi_pool_t *pool; 421 uint32_ti = 0;421 wi_uinteger_t i = 0; 422 422 int signal; 423 423 wired/trunk/wired/main.h
r3551 r4426 42 42 extern wi_lock_t *wd_status_lock; 43 43 extern wi_date_t *wd_start_date; 44 extern unsigned intwd_current_users, wd_total_users;45 extern unsigned intwd_current_downloads, wd_total_downloads;46 extern unsigned intwd_current_uploads, wd_total_uploads;47 extern unsigned long longwd_downloads_traffic, wd_uploads_traffic;44 extern wi_uinteger_t wd_current_users, wd_total_users; 45 extern wi_uinteger_t wd_current_downloads, wd_total_downloads; 46 extern wi_uinteger_t wd_current_uploads, wd_total_uploads; 47 extern wi_file_offset_t wd_downloads_traffic, wd_uploads_traffic; 48 48 49 49 #endif /* WD_MAIN_H */ wired/trunk/wired/news.c
r4403 r4426 80 80 wi_file_t *file, *tmpfile = NULL; 81 81 wi_string_t *string, *separator, *post = NULL; 82 uint32_ti = 0;82 wi_uinteger_t i = 0; 83 83 wi_boolean_t first = true; 84 84 wired/trunk/wired/server.c
r4403 r4426 272 272 wi_string_t *ip; 273 273 wd_client_t *client; 274 uint32_ti = 0;274 wi_uinteger_t i = 0; 275 275 276 276 pool = wi_pool_init(wi_pool_alloc()); … … 326 326 wi_string_t *ip, *string, *command; 327 327 wd_transfer_t *transfer; 328 uint32_ti = 0;328 wi_uinteger_t i = 0; 329 329 330 330 pool = wi_pool_init(wi_pool_alloc()); wired/trunk/wired/settings.h
r4403 r4426 45 45 wi_boolean_t banner_changed; 46 46 wi_array_t *address; 47 uint32_tport;47 wi_uinteger_t port; 48 48 49 49 uid_t user; … … 52 52 wi_time_interval_t idletime; 53 53 wi_time_interval_t bantime; 54 uint32_tnewslimit;54 wi_uinteger_t newslimit; 55 55 56 56 wi_string_t *files; … … 67 67 wi_array_t *tracker; 68 68 wi_string_t *url; 69 uint32_tbandwidth;69 wi_uinteger_t bandwidth; 70 70 71 uint32_ttotaldownloads;72 uint32_ttotaluploads;73 uint32_tclientdownloads;74 uint32_tclientuploads;75 uint32_ttotaldownloadspeed;76 uint32_ttotaluploadspeed;71 wi_uinteger_t totaldownloads; 72 wi_uinteger_t totaluploads; 73 wi_uinteger_t clientdownloads; 74 wi_uinteger_t clientuploads; 75 wi_uinteger_t totaldownloadspeed; 76 wi_uinteger_t totaluploadspeed; 77 77 78 78 wi_string_t *controlcipher; wired/trunk/wired/trackers.c
r4403 r4426 124 124 wi_address_t *address; 125 125 wd_tracker_t *tracker; 126 uint32_tport;126 wi_uinteger_t port; 127 127 128 128 wi_array_wrlock(wd_trackers); … … 419 419 wi_socket_t *socket; 420 420 wi_string_t *string = NULL; 421 wi_integer_t bytes; 421 422 uint32_t guest, download; 422 int bytes;423 423 424 424 guest = (wd_trackers_guest_account != NULL); … … 484 484 static wi_boolean_t wd_tracker_write(wd_tracker_t *tracker, wi_string_t *fmt, ...) { 485 485 wi_string_t *string; 486 intbytes;486 wi_integer_t bytes; 487 487 va_list ap; 488 488 wired/trunk/wired/transfers.c
r4403 r4426 102 102 wi_time_interval_t interval; 103 103 wi_boolean_t update = false; 104 uint32_ti, count;104 wi_uinteger_t i, count; 105 105 106 106 wi_array_wrlock(wd_transfers); … … 225 225 wi_boolean_t wd_transfers_can_queue(wd_transfer_type_t type) { 226 226 wd_client_t *client = wd_client(); 227 uint32_ti, count, limit;227 wi_uinteger_t i, count, limit; 228 228 229 229 limit = (type == WD_TRANSFER_DOWNLOAD) ? wd_settings.clientdownloads : wd_settings.clientuploads; … … 253 253 254 254 255 uint32_t wd_transfers_count_of_client(wd_client_t *client, wd_transfer_type_t type) {255 wi_uinteger_t wd_transfers_count_of_client(wd_client_t *client, wd_transfer_type_t type) { 256 256 wd_transfer_t *transfer; 257 uint32_ti, count, clientcount = 0;257 wi_uinteger_t i, count, clientcount = 0; 258 258 259 259 wi_array_rdlock(wd_transfers); … … 280 280 wd_transfer_t *transfer; 281 281 wi_boolean_t update = false; 282 uint32_ti, count;282 wi_uinteger_t i, count; 283 283 284 284 wi_array_wrlock(wd_transfers); … … 319 319 wd_transfer_t * wd_transfers_transfer_with_hash(wi_string_t *hash) { 320 320 wd_transfer_t *transfer, *value = NULL; 321 uint32_ti, count;321 wi_uinteger_t i, count; 322 322 323 323 wi_array_rdlock(wd_transfers); … … 348 348 wd_transfer_t *transfer; 349 349 wd_client_t *client; 350 uint32_tposition_downloads, position_uploads;351 uint32_tclient_downloads, client_uploads;352 uint32_tall_downloads, all_uploads;353 uint32_tposition;354 uint32_ti, count;350 wi_uinteger_t position_downloads, position_uploads; 351 wi_uinteger_t client_downloads, client_uploads; 352 wi_uinteger_t all_downloads, all_uploads; 353 wi_uinteger_t position; 354 wi_uinteger_t i, count; 355 355 356 356 wi_array_rdlock(wd_transfers); … … 541 541 542 542 static inline void wd_transfer_limit_download_speed(wd_transfer_t *transfer, ssize_t bytes, wi_time_interval_t now, wi_time_interval_t then) { 543 uint32_t limit, totallimit;543 wi_uinteger_t limit, totallimit; 544 544 545 545 if(transfer->client->account->download_speed > 0 || wd_settings.totaldownloadspeed > 0) { … … 569 569 570 570 static inline void wd_transfer_limit_upload_speed(wd_transfer_t *transfer, ssize_t bytes, wi_time_interval_t now, wi_time_interval_t then) { 571 uint32_t limit, totallimit;571 wi_uinteger_t limit, totallimit; 572 572 573 573 if(transfer->client->account->upload_speed > 0 || wd_settings.totaluploadspeed > 0) { … … 627 627 char buffer[WD_TRANSFER_BUFFER_SIZE]; 628 628 wi_time_interval_t interval, speedinterval, statusinterval; 629 wi_socket_state_t state; 629 630 ssize_t bytes, speedbytes, statsbytes; 630 uint32_ti = 0;631 int fd, sd , state;631 wi_uinteger_t i = 0; 632 int fd, sd; 632 633 633 634 pool = wi_pool_init(wi_pool_alloc()); … … 675 676 do { 676 677 state = wi_socket_wait_descriptor(sd, 0.1, false, true); 677 } while(state == 0&& transfer->state == WD_TRANSFER_RUNNING);678 } while(state == WI_SOCKET_TIMEOUT && transfer->state == WD_TRANSFER_RUNNING); 678 679 679 680 if(transfer->state != WD_TRANSFER_RUNNING) { … … 682 683 } 683 684 684 if(state < 0) {685 if(state == WI_SOCKET_ERROR) { 685 686 if(wi_error_code() == EINTR) { 686 687 /* got a signal */ … … 763 764 char buffer[WD_TRANSFER_BUFFER_SIZE]; 764 765 wi_time_interval_t interval, speedinterval, statusinterval; 766 wi_socket_state_t state; 765 767 ssize_t bytes, speedbytes, statsbytes; 766 uint32_ti = 0;767 int sd, fd , state;768 wi_uinteger_t i = 0; 769 int sd, fd; 768 770 769 771 pool = wi_pool_init(wi_pool_alloc()); … … 803 805 do { 804 806 state = wi_socket_wait_descriptor(sd, 0.1, true, false); 805 } while(state == 0&& transfer->state == WD_TRANSFER_RUNNING);807 } while(state == WI_SOCKET_TIMEOUT && transfer->state == WD_TRANSFER_RUNNING); 806 808 807 809 if(transfer->state != WD_TRANSFER_RUNNING) { … … 810 812 } 811 813 812 if(state < 0) {814 if(state == WI_SOCKET_ERROR) { 813 815 if(wi_error_code() == EINTR) { 814 816 /* got a signal */ wired/trunk/wired/transfers.h
r4403 r4426 69 69 wd_transfer_type_t type; 70 70 71 u nsigned intqueue;71 uint32_t queue; 72 72 wi_time_interval_t queue_time; 73 73 … … 75 75 wi_file_offset_t size; 76 76 wi_file_offset_t transferred; 77 u nsigned intspeed;77 uint32_t speed; 78 78 }; 79 79 typedef struct _wd_transfer wd_transfer_t; … … 86 86 void wd_transfers_queue_upload(wi_string_t *, wi_file_offset_t, wi_string_t *); 87 87 wi_boolean_t wd_transfers_can_queue(wd_transfer_type_t); 88 unsigned int wd_transfers_count_of_client(wd_client_t *, wd_transfer_type_t);88 wi_uinteger_t wd_transfers_count_of_client(wd_client_t *, wd_transfer_type_t); 89 89 void wd_transfers_remove_client(wd_client_t *); 90 90 wd_transfer_t * wd_transfers_transfer_with_hash(wi_string_t *);
