Changeset 5857


Ignore:
Timestamp:
May 20, 2008, 2:01:15 PM (14 years ago)
Author:
charles
Message:

tweak the daemon & remote console messages a little

Location:
trunk/daemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/daemon.c

    r5854 r5857  
    6464    tr_bencDictAddStr( &d, "encryption", str );
    6565
    66     tr_ninf( MY_NAME, "saving \"%s\"\n", gl_configfile );
     66    tr_ninf( MY_NAME, "saving \"%s\"", gl_configfile );
    6767    tr_bencSaveFile( gl_configfile, &d );
    6868
     
    207207            break;
    208208        case -1:
    209             tr_nerr( MY_NAME, "Error daemonizing (fork)! %d - %s\n", errno, strerror(errno) );
     209            tr_nerr( MY_NAME, "Error daemonizing (fork)! %d - %s", errno, strerror(errno) );
    210210            return -1;
    211211        default:
     
    214214
    215215    if( setsid() < 0 ) {
    216         tr_nerr( MY_NAME, "Error daemonizing (setsid)! %d - %s\n", errno, strerror(errno) );
     216        tr_nerr( MY_NAME, "Error daemonizing (setsid)! %d - %s", errno, strerror(errno) );
    217217        return -1;
    218218    }
     
    222222            break;
    223223        case -1:
    224             tr_nerr( MY_NAME, "Error daemonizing (fork2)! %d - %s\n", errno, strerror(errno) );
     224            tr_nerr( MY_NAME, "Error daemonizing (fork2)! %d - %s", errno, strerror(errno) );
    225225            return -1;
    226226        default:
     
    229229
    230230    if( !nochdir && 0 > chdir( "/" ) ) {
    231         tr_nerr( MY_NAME, "Error daemonizing (chdir)! %d - %s\n", errno, strerror(errno) );
     231        tr_nerr( MY_NAME, "Error daemonizing (chdir)! %d - %s", errno, strerror(errno) );
    232232        return -1;
    233233    }
  • trunk/daemon/remote.c

    r5855 r5857  
    259259
    260260static void
    261 processResponse( const void * response, size_t len )
     261processResponse( const char * host, int port,
     262                 const void * response, size_t len )
    262263{
    263264    tr_benc top;
    264265
    265266    if( tr_jsonParse( response, len, &top, NULL ) )
    266        tr_nerr( MY_NAME, "Unable to parse response\n" );
     267       tr_nerr( MY_NAME, "Unable to parse response" );
    267268    else
    268269    {
     
    273274
    274275        if( tr_bencDictFindStr( &top, "result", &str ) )
    275             printf( "Server responded: \"%s\"\n", str );
     276            printf( "%s:%d responded: \"%s\"\n", host, port, str );
    276277
    277278        if( ( tag == TAG_LIST ) &&
     
    329330        curl_easy_setopt( curl, CURLOPT_POSTFIELDS, reqs[i] );
    330331        if(( res = curl_easy_perform( curl )))
    331             tr_nerr( MY_NAME, "%s\n", curl_easy_strerror( res ) );
     332            tr_nerr( MY_NAME, "(%s:%d) %s", host, port, curl_easy_strerror( res ) );
    332333        else
    333             processResponse( EVBUFFER_DATA( buf ), EVBUFFER_LENGTH( buf ) );
     334            processResponse( host, port, EVBUFFER_DATA( buf ), EVBUFFER_LENGTH( buf ) );
    334335
    335336        evbuffer_drain( buf, EVBUFFER_LENGTH( buf ) );
Note: See TracChangeset for help on using the changeset viewer.