Virtual socket error handling fixed.

Entropy fix reverted to make yotta build working.
This must be fixed properly later.
pull/3240/head
Tero Heinonen 2016-02-11 13:23:08 +02:00
parent 45daf83135
commit 6dd666a455
2 changed files with 11 additions and 2 deletions

View File

@ -529,7 +529,8 @@ int coap_connection_handler_virtual_recv(coap_conn_handler_t *handler, uint8_t a
}
}else{
if( !session->secure_done ){
if( coap_security_handler_continue_connecting(session->sec_handler) == 0){
int ret = coap_security_handler_continue_connecting(session->sec_handler);
if(ret == 0){
session->secure_done = true;
if( handler->_security_done_cb ){
handler->_security_done_cb(sock->listen_socket,
@ -538,6 +539,12 @@ int coap_connection_handler_virtual_recv(coap_conn_handler_t *handler, uint8_t a
}
return 0;
}
else if(ret < 0)
{
// error handling
// TODO: here we also should clear CoAP retransmission buffer and inform that CoAP request sending is failed.
secure_session_delete(session);
}
//TODO: error handling
}else{
unsigned char *data = ns_dyn_mem_temporary_alloc(sock->data_len);

View File

@ -60,8 +60,10 @@ static int coap_security_handler_init(coap_security_t *sec){
sec->_is_started = false;
//TODO: Must have at least 1 strong entropy source, otherwise DTLS will fail.
//This is NOT strong even we say it is!
if( mbedtls_entropy_add_source( &sec->_entropy, entropy_poll, NULL,
128, 0 ) < 0 ){
128, 1 ) < 0 ){
return -1;
}