Check error codes correctly in instead of reporting all errors as 'assert'.

Add TR_ERROR_IO_SPACE and TR_ERROR_IO_RESOURCES.
This commit is contained in:
Josh Elsasser 2007-05-09 18:41:22 +00:00
parent 04691c6f3e
commit 5fe9d0fcea
3 changed files with 20 additions and 8 deletions

View File

@ -700,27 +700,35 @@ ipc_addstat( benc_val_t * list, int tor, tr_info_t * inf,
{
tr_bencInitStr( item, NULL, 0, 1 );
}
else if( TR_ERROR_ASSERT & st->error )
else if( TR_ERROR_ISSET( TR_ERROR_ASSERT, st->error ) )
{
tr_bencInitStr( item, "assert", -1, 1 );
}
else if( TR_ERROR_IO_PARENT & st->error )
else if( TR_ERROR_ISSET( TR_ERROR_IO_PARENT, st->error ) )
{
tr_bencInitStr( item, "io-parent", -1, 1 );
}
else if( TR_ERROR_IO_PERMISSIONS & st->error )
else if( TR_ERROR_ISSET( TR_ERROR_IO_PERMISSIONS, st->error ) )
{
tr_bencInitStr( item, "io-permissions", -1, 1 );
}
else if( TR_ERROR_IO_MASK & st->error )
else if( TR_ERROR_ISSET( TR_ERROR_IO_SPACE, st->error ) )
{
tr_bencInitStr( item, "io-space", -1, 1 );
}
else if( TR_ERROR_ISSET( TR_ERROR_IO_RESOURCES, st->error ) )
{
tr_bencInitStr( item, "io-resources", -1, 1 );
}
else if( TR_ERROR_ISSET( TR_ERROR_IO_MASK, st->error ) )
{
tr_bencInitStr( item, "io-other", -1, 1 );
}
else if( TR_ERROR_TC_ERROR & st->error )
else if( TR_ERROR_ISSET( TR_ERROR_TC_ERROR, st->error ) )
{
tr_bencInitStr( item, "tracker-error", -1, 1 );
}
else if( TR_ERROR_TC_WARNING & st->error )
else if( TR_ERROR_ISSET( TR_ERROR_TC_WARNING, st->error ) )
{
tr_bencInitStr( item, "tracker-warning", -1, 1 );
}

View File

@ -386,8 +386,10 @@ which support is mandatory is "id".
"download-total" integer, total bytes downloaded so far
"error" string, one of the following:
"assert" something happened that shouldn't
"io-parent" I dunno
"io-permissions" filesystem permission error probably
"io-parent" missing parent directory
"io-permissions" filesystem permission error
"io-space" not enough free space in filesystem
"io-resource" insufficient resources
"io-other" other filesystem i/o error
"tracker-error" tracker returned error message
"tracker-warning" tracker returned warning message

View File

@ -80,6 +80,8 @@ extern "C" {
#define TR_ERROR_TC_ERROR 0x80000100
#define TR_ERROR_TC_WARNING 0x80000200
#define TR_ERROR_ISSET( num, code ) ( (code) == ( (code) & (num) ) )
/***********************************************************************
* tr_init
***********************************************************************