error cleanup, log cleanup, bug fixes

This commit is contained in:
Daniel Larimer 2013-07-18 22:19:19 -04:00
parent 3eae44103d
commit f5f3bb5102
4 changed files with 19 additions and 7 deletions

View file

@ -352,7 +352,7 @@ struct ssl_bignum
(const unsigned char*)&digest, sizeof(digest),
(unsigned char*)&sig, &buf_len, my->_key ) )
{
fprintf( stderr, "sign error\n");
FC_THROW_EXCEPTION( exception, "signing error" );
}
@ -442,7 +442,7 @@ struct ssl_bignum
{
EC_KEY_set_conv_form( my->_key, POINT_CONVERSION_COMPRESSED );
nV -= 4;
fprintf( stderr, "compressed\n" );
// fprintf( stderr, "compressed\n" );
}
if (ECDSA_SIG_recover_key_GFp(my->_key, sig, (unsigned char*)&digest, sizeof(digest), nV - 27, 0) == 1)

View file

@ -73,7 +73,7 @@ namespace fc {
///////////////
std::stringstream line;
line << (m.get_context().get_timestamp().time_since_epoch().count() % (1000ll*1000ll*60ll*60))/1000 <<"ms ";
line << std::setw( 10 ) << m.get_context().get_thread_name().substr(0,9).c_str() <<" "<<std::setw(20)<<file_line.str();
line << std::setw( 10 ) << std::left << m.get_context().get_thread_name().substr(0,9).c_str() <<" "<<std::setw(20)<< std::left <<file_line.str();
auto me = m.get_context().get_method();
// strip all leading scopes...
@ -86,7 +86,7 @@ namespace fc {
}
if( me[p] == ':' ) ++p;
line << std::setw( 20 ) << m.get_context().get_method().substr(p,20).c_str() <<" ";
line << std::setw( 20 ) << std::left << m.get_context().get_method().substr(p,20).c_str() <<" ";
}
line << "] ";
fc::string message = fc::format_string( m.get_format(), m.get_data() );

View file

@ -4,6 +4,7 @@
#include <fc/asio.hpp>
#include <fc/log/logger.hpp>
#include <fc/io/stdio.hpp>
#include <fc/exception/exception.hpp>
namespace fc {
@ -25,7 +26,12 @@ namespace fc {
void tcp_socket::flush() {}
void tcp_socket::close() {
if( is_open() ) my->_sock.close();
try {
if( is_open() )
{
my->_sock.close();
}
} FC_RETHROW_EXCEPTIONS( warn, "error closing tcp socket" );
}
bool tcp_socket::eof()const {
@ -57,7 +63,13 @@ namespace fc {
_accept( fc::asio::default_io_service(), boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port) ){
}
~impl(){
_accept.close();
try {
_accept.close();
}
catch ( boost::system::system_error& e )
{
wlog( "unexpected exception ${e}", ("e", fc::except_str()) );
}
}
boost::asio::ip::tcp::acceptor _accept;

View file

@ -55,7 +55,7 @@ namespace fc {
pt_head = temp;
}
*/
ilog("");
//ilog("");
if (boost_thread)
{
boost_thread->detach();