Changeset 6811


Ignore:
Timestamp:
Sep 29, 2008, 4:26:52 AM (13 years ago)
Author:
charles
Message:

(libT) make sure to init the rpc server with the correct event base.

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/rpc-server.c

    r6810 r6811  
    2929#include "rpcimpl.h"
    3030#include "rpc-server.h"
     31#include "trevent.h"
    3132#include "utils.h"
    3233#include "web.h"
     
    328329{
    329330    struct tr_rpc_server * server = arg;
    330     tr_ndbg( MY_NAME, _( "Got request: \"%s\"" ), req->uri );
     331    fprintf( stderr, "%s:%d Got request: \"%s\"\n", __FILE__, __LINE__, req->uri );
    331332
    332333    if( req && req->evcon )
     
    394395        tr_free( user );
    395396    }
     397    fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    396398}
    397399
     
    399401startServer( tr_rpc_server * server )
    400402{
    401     dbgmsg( "in startServer; current context is %p", server->httpd );
     403    fprintf( stderr, "%s:%d in startServer; current context is %p\n", __FILE__, __LINE__, server->httpd );
    402404
    403405    if( !server->httpd )
    404406    {
    405         if( ( server->httpd = evhttp_start( "0.0.0.0", server->port ) ) )
    406             evhttp_set_gencb( server->httpd, handle_request, server );
    407         else
    408             tr_nerr( MY_NAME, _( "Failed to start RPC server" ) );
     407        int i;
     408        server->httpd = evhttp_new( tr_eventGetBase( server->session ) );
     409        fprintf( stderr, "%s:%d in startServer; new context is %p\n", __FILE__, __LINE__, server->httpd );
     410        i = evhttp_bind_socket( server->httpd, "0.0.0.0", server->port );
     411        fprintf( stderr, "evhttp_bind_socket returned %d\n", i );
    409412    }
    410413}
  • trunk/libtransmission/trevent.c

    r6795 r6811  
    303303}
    304304
     305struct event_base *
     306tr_eventGetBase( tr_session * session )
     307{
     308    return session->events->base;
     309}
  • trunk/libtransmission/trevent.h

    r6795 r6811  
    2222
    2323void      tr_eventClose( struct tr_handle * tr_handle );
     24
     25struct event_base * tr_eventGetBase( struct tr_handle * tr_handle );
    2426
    2527
Note: See TracChangeset for help on using the changeset viewer.