Changeset 4675

Show
Ignore:
Timestamp:
02/20/07 17:01:03 (2 years ago)
Author:
morris
Message:

P7 tests

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wired/branches/p7/wired/commands.c

    r4568 r4675  
    222222        wd_client_t                     *client = argument; 
    223223        wi_string_t                     *string; 
     224        wi_p7_message_t         *message; 
    224225        wi_socket_state_t       state; 
    225226        wi_uinteger_t           i = 0; 
     
    252253                } 
    253254 
    254               wd_client_lock_socket(client); 
     255/*            wd_client_lock_socket(client); 
    255256                string = wi_socket_read_to_string(client->socket, 0.0, WI_STR(WD_MESSAGE_SEPARATOR_STR)); 
    256257                wd_client_unlock_socket(client); 
     
    263264                } 
    264265 
    265                 wd_parse_command(string); 
     266                wd_parse_command(string);*/ 
     267                 
     268                wd_client_lock_socket(client); 
     269                message = wi_p7_socket_read_message(client->p7_socket, 0.0); 
     270                wd_client_unlock_socket(client); 
     271                 
     272                if(!message) { 
     273                        wi_log_info(WI_STR("Could not read from %@: %m"), client->ip); 
     274                         
     275                        break; 
     276                } 
     277                 
     278                wi_log_info(WI_STR("read %@"), message); 
    266279                 
    267280                if(++i % 10 == 0) 
  • wired/branches/p7/wired/server.c

    r4646 r4675  
    4545#include "files.h" 
    4646#include "main.h" 
     47#include "messages.h" 
    4748#include "server.h" 
    4849#include "settings.h" 
     
    261262void wd_ssl_init(void) { 
    262263        wd_rsa = wi_rsa_init_with_bits(wi_rsa_alloc(), 1024); 
     264         
     265/*      wi_p7_cipher_t *cipher = wi_p7_cipher_init_with_random_key(wi_p7_cipher_alloc(), WI_P7_CIPHER_AES_256); 
     266         
     267        wi_log_info(WI_STR("cipher = %@"), cipher); 
     268         
     269        if(!cipher) 
     270                wi_log_err(WI_STR("%m")); 
     271         
     272        wi_string_t *string0 = WI_STR("a"); 
     273 
     274        wi_log_info(WI_STR("string0 = %@"), string0); 
     275 
     276        wi_data_t *data0 = wi_string_data(string0); 
     277 
     278        wi_log_info(WI_STR("data0 = %@"), data0); 
     279 
     280        wi_data_t *data1 = wi_p7_cipher_encrypt_data(cipher, data0); 
     281         
     282        wi_log_info(WI_STR("data1 = %@"), data1); 
     283 
     284        wi_data_t *data2 = wi_p7_cipher_decrypt_data(cipher, data1); 
     285         
     286        if(!data2) 
     287                wi_log_err(WI_STR("%m")); 
     288         
     289        wi_log_info(WI_STR("data2 = %@"), data2); 
     290         
     291        wi_string_t *string1 = wi_string_with_data(data2); 
     292         
     293        wi_log_info(WI_STR("string1 = %@"), string1); 
     294         
     295        wi_release(cipher);*/ 
    263296} 
    264297 
     
    314347                client = wi_autorelease(wd_client_init_with_socket(wd_client_alloc(), p7_socket)); 
    315348 
    316                 if(!wi_thread_create_thread(wd_control_thread, client)) 
     349                if(!wi_thread_create_thread(wd_control_thread2, client)) 
    317350                        wi_log_err(WI_STR("Could not create a thread for %@: %m"), ip); 
    318351