[Ace-users] Configure number of connections ACE_Acceptor will accept

mitch.seybold at gmail.com mitch.seybold at gmail.com
Thu Feb 28 16:01:19 CST 2008


On Feb 28, 12:53 pm, schm... at dre.vanderbilt.edu (Douglas C. Schmidt)
wrote:
> Hi Mitch,
>
>    Thanks for the version info.
>
> >acetao-1.5.1.0  Windows XP
> >Will have to run down PROBLEM-REPORT-FORM as our sys admin did not
> >place it in $ACE_ROOT
>
> >I attempted to limit the number of connection in the
> >Gateway::ConnectionAcceptor::make_svc_handler by not instantiating a
> >new SvcHandler and returning from the method if svcHandler_ was not
> >0.  When I returned 0, my process core dumped.  What should be
> >returned?
>
> I think you need to return -1 from make_svc_handler().  BTW, this is
> discussed/illustrated in Chapter 7 of C++NPv2
> <www.cs.wustl.edu/~schmidt/ACE/book2/>.
>
> Thanks,
>
>         Doug
> --
> Dr. Douglas C. Schmidt                       Professor and Associate Chair
> Electrical Engineering and Computer Science  TEL: (615) 343-8197
> Vanderbilt University                        WEB:www.dre.vanderbilt.edu/~schmidt
> Nashville, TN 37203                          NET: d.schm... at vanderbilt.edu

Doug - I'll be on my way to the book store tonight after work :)

Now returning -1, no core dump, but make_svc_handler() is infinitely
called upon the second connection request.  (Checked my java client to
ensure it's not the culprit)

Does the 'svcHandler' argument need to be set (return a value to the
caller) to member variable svcHandler_ (the SvcHandler from the
initial connection)?  Should it be set to 0?
Need to be able to tell whomever is calling make_svc_handler (the
reactor?, event_handler?) to refuse the connection and not call
make_svc_handler again.

int Gateway::ConnectionAcceptor::make_svc_handler(SvcHandler*&
svcHandler)
{
    std::cout << "Gateway::ConnectionAcceptor::make_svc_handler..."
            << "  i.e. connection request"
            << std::endl;

    if (svcHandler_ != 0)   // already have a svcHandler (peer)
    {
        std::cout << "Gateway::ConnectionAcceptor::make_svc_handler "
            << "client already connected." << std::endl;
        svcHandler = svcHandler_;   // DOES THIS NEED TO BE DONE?
        return -1;
    }

    svcHandler_ = new SvcHandler(gateway_, gatewayData_);
    svcHandler_->reactor(ACE_Reactor::instance());
    svcHandler = svcHandler_;
    return 0;
}

std::out --

Gateway::ConnectionAcceptor::ConnectionAcceptor... // Acceptor
constructor
Gateway::ConnectionAcceptor::make_svc_handler...   // first connect
request from peer
Gateway::SvcHandler::SvcHandler...                           //
SvcHandler constructor, instantiated in make_svc_handler
Gateway::SvcHandler::open...                                    //
SvcHandler open() called by ?
// some time later....
Gateway::ConnectionAcceptor::make_svc_handler...  i.e. connection
request   // second connect request from peer
Gateway::ConnectionAcceptor::make_svc_handler client already
connected.    // make_svc_handler detectes member svcHandler_ is not
0, returns -1
Gateway::ConnectionAcceptor::make_svc_handler...  i.e. connection
request   // forever
Gateway::ConnectionAcceptor::make_svc_handler client already
connected.
Gateway::ConnectionAcceptor::make_svc_handler...  i.e. connection
request
Gateway::ConnectionAcceptor::make_svc_handler client already
connected.
Gateway::ConnectionAcceptor::make_svc_handler...  i.e. connection
request

ad nauseum...


More information about the Ace-users mailing list