Changeset 3830

Show
Ignore:
Timestamp:
02/28/06 22:22:00 (3 years ago)
Author:
morris
Message:

Now that release happens sometimes later, explicitly close transfer sockets immediately

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wired/trunk/wired/main.c

    r3764 r3830  
    254254        wi_release(pool); 
    255255        pool = wi_pool_init(wi_pool_alloc()); 
    256  
     256         
    257257        /* enter the signal handling thread in the main thread */ 
    258258        wd_signal_thread(NULL); 
  • wired/trunk/wired/server.c

    r3809 r3830  
    318318 
    319319next: 
    320                 if(++i % 100 == 0) { 
     320                if(++i % 10 == 0) { 
    321321                        wi_release(pool); 
    322322                        pool = NULL; 
     
    352352                /* accept new connection */ 
    353353                socket = wi_socket_accept_multiple(wd_transfer_sockets, wd_transfer_socket_context, 30.0, &address); 
    354  
     354                 
    355355                if(!address) { 
    356356                        wi_log_err(WI_STR("Could not accept a connection: %m")); 
     
    397397 
    398398next: 
    399                 if(++i % 100 == 0) { 
     399                if(++i % 10 == 0) { 
    400400                        wi_release(pool); 
    401401                        pool = NULL; 
  • wired/trunk/wired/transfers.c

    r3809 r3830  
    391391 
    392392static wd_transfer_t * wd_transfer_init_with_client(wd_transfer_t *transfer, wd_client_t *client) { 
    393         wi_string_t             *string; 
    394          
    395393        transfer->state                 = WD_TRANSFER_QUEUED; 
    396394        transfer->client                = wi_retain(client); 
    397  
    398         string                                  = wi_string_init_random_string_with_length(wi_string_alloc(), 1024); 
    399         transfer->hash                  = wi_retain(wi_string_sha1(string)); 
    400         wi_release(string); 
    401  
     395        transfer->hash                  = wi_retain(wi_data_sha1(wi_data_with_random_bytes(1024))); 
    402396        transfer->state_lock    = wi_condition_lock_init_with_condition(wi_condition_lock_alloc(), transfer->state); 
    403397 
     
    692686 
    693687end: 
     688        wi_socket_close(transfer->socket); 
     689 
    694690        if(fd >= 0) 
    695691                close(fd); 
     
    839835 
    840836end: 
     837        wi_socket_close(transfer->socket); 
     838 
    841839        if(fd >= 0) 
    842840                close(fd);