Re: [Openh323gk-users] gnugk load balancing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Hemant Kumar <smith@hmhtel.com> wrote:
> can you send your patch once again ?
> 

Not as patch :-(
Only description. And this is for 2.0.3 or 2.0.4- I
don't remember.

in RasTbl.h
I added following method to class EndpointRec

  int ActiveCalls(); 
  inline int EndpointRec::ActiveCalls() 
  {
        return m_activeCall;
  }

and in RasTbl.cxx now InternalFindEP looks following:


endptr RegistrationTable::InternalFindEP(const
H225_ArrayOf_AliasAddress & alias,
        list<EndpointRec *> *List, bool roundrobin)
{
        endptr ep =
InternalFind(bind2nd(mem_fun(&EndpointRec::CompareAlias),
&alias), List);
        if (ep) {
                PTRACE(4, "Alias match for EP " <<
AsDotString(ep->GetCallSignalAddress()));
                return ep;
        }

        int maxlen = 0;
        list<EndpointRec *> GWlist;
        listLock.StartRead();
        const_iterator Iter = List->begin(), IterLast
= List->end();
        while (Iter != IterLast) {
                if ((*Iter)->IsGateway()) {
                        int len =
dynamic_cast<GatewayRec *>(*Iter)->PrefixMatch(alias);
                        if (maxlen < len) {
                                GWlist.clear();
                                maxlen = len;
                        }
                        if (maxlen == len)
                               
GWlist.push_back(*Iter);
                }
                ++Iter;
        }
        listLock.EndRead();

        if (GWlist.size() > 0) {
                EndpointRec *e = GWlist.front();
                if ((GWlist.size() > 1) && roundrobin)
{
                        PTRACE(3, ANSI::DBG << "Prefix
apply round robin" << ANSI::OFF);
                        WriteLock lock(listLock);
                        List->remove(e);
                        List->push_back(e);

                        
                        //getting gateway with less
call number
                         int calls=65535;
                         const_iterator
Iter_dm=GWlist.begin(),
                         IterLast_dm=GWlist.end();
                         while (Iter_dm !=
IterLast_dm) {
                           if
((*Iter_dm)->ActiveCalls() <=  calls) {
                            
calls=(*Iter_dm)->ActiveCalls();
                             PTRACE(1, "Calls " <<
calls<<"\n");
                             e=*Iter_dm;
                             }
                             ++Iter_dm;
                          }

                }
                PTRACE(4, "Alias match for GW " <<
AsDotString(e->GetCallSignalAddress()));
                return endptr(e);
        }
        return endptr(0);
}



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
List: Openh323gk-users@lists.sourceforge.net
Archive: http://sourceforge.net/mailarchive/forum.php?forum_id=8549
Homepage: http://www.gnugk.org/

[Index of Archives]     [SIP]     [Open H.323]     [Gnu Gatekeeper]     [Asterisk PBX]     [ISDN Cause Codes]     [Yosemite News]

  Powered by Linux