Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Linux Servers

Support::Linux Servers Support forum for Linux EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 09-23-2008, 05:18 AM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

I tried reorganising the code to work as you originally intended. This is totally untested.

Note that in the case where a connection is removed, I have put a continue; statement which will go back to the top of the while loop, as I don't believe you want to advance the iterator if you've just deleted an element.

Code:
void ClientList::GetCLEIP(int32 iIP) {

        ClientListEntry* countCLEIPs = 0;
        LinkedListIterator<ClientListEntry*> iterator(clientlist);

        int IPInstances = 0;
        iterator.Reset();

        while(iterator.MoreElements()) {

                countCLEIPs = iterator.GetData();

                // If the IP matches, and the connection admin status is below the exempt status,
                // or exempt status is less than 0 (no-one is exempt)

                if ((countCLEIPs->GetIP() == iIP) &&
                    ((countCLEIPs->Admin() < (RuleI(World, ExemptMaxClientsStatus))) ||
                     (RuleI(World, ExemptMaxClientsStatus) < 0))) {

                        // Increment the occurences of this IP address

                        IPInstances++;

                        // If the number of connections exceeds the lower limit

                        if (IPInstances > (RuleI(World, MaxClientsPerIP))){

                                // If the Admin status of the connection is not eligible for the higher limit,
                                // or there is no higher limit (AddMaxClientStatus<0)

                                if ((countCLEIPs->Admin() < (RuleI(World, AddMaxClientsStatus)) ||
                                    (RuleI(World, AddMaxClientsStatus) < 0))) {

                                        // Remove the connection

                                        countCLEIPs->SetOnline(CLE_Status_Offline);
                                        iterator.RemoveCurrent();
                                        continue;

                                }
                                // else they are eligible for the higher limit, but if they exceed that

                                else if (IPInstances > RuleI(World, AddMaxClientsPerIP)) {

                                        // Remove the connection

                                        countCLEIPs->SetOnline(CLE_Status_Offline);
                                        iterator.RemoveCurrent();
                                        continue;

                                }
                        }
                }
                iterator.Advance();
        }
}
Reply With Quote
  #2  
Old 09-23-2008, 05:44 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Thanks for the post! I have been working on it some too. This is all I have come up with so far:


Code:
//Lieka Edit Begin: Check current CLE Entry IPs against incoming connection

void ClientList::GetCLEIP(int32 iIP) {
	ClientListEntry* countCLEIPs = 0;
	LinkedListIterator<ClientListEntry*> iterator(clientlist);

	int IPInstances = 0;
	iterator.Reset();
	while(iterator.MoreElements()) {
		countCLEIPs = iterator.GetData();
		if (countCLEIPs->GetIP() == iIP) {
			IPInstances++;
			if (IPInstances > (((countCLEIPs->Admin() - (RuleI(World, AddMaxClientsStatus)) + (RuleI(World, MaxClientsPerIP)) + 1) && (RuleI(World, MaxClientsPerIP))) || ((RuleI(World, MaxClientsPerIP)) && (RuleI(World, AddMaxClientsStatus) < 0)))) {
				countCLEIPs->SetOnline(CLE_Status_Offline);
				iterator.RemoveCurrent();
			}
		}
		iterator.Advance();
	}
}
//Lieka Edit End
And, I think this should work for the most part. This stuff hurts my head to think about lol. The only part I still need to figure out is if there is a way to set it to exempt accounts that are above the AddMaxClientsStatus, but still limit them to the total count that they should be set to. The total limit for accounts over the AddMaxClientsStatus should be:

(countCLEIPs->Admin() - (RuleI(World, AddMaxClientsStatus)) + (RuleI(World, MaxClientsPerIP)) + 1)

So, if the account status is 5 and the AddMaxClientsStatus is set to 2 and the MaxClientsPerIP is set to 3, then the equation would look like:

5 - 2 + 3 + 1 = 7

So, they would be able to log in 7 accounts total which is 4 more than all normal accounts below the AddMaxClientsStatus can log in.

Another example is if the account status is 2 and the AddMaxClientsStatus is set to 2 and the MaxClientsPerIP is set to 1, then the equation would look like:

2 - 2 + 1 + 1 = 2

So, they would be able to log in 2 accounts total which is 1 more than all normal accounts below the AddMaxClientsStatus can log in.

The hard part I can't figure out is what happens if they log in multiple accounts all with different statuses on them.... Does it use the highest given account status to define the total of all accounts that can be connected, or does it go on a case by case basis. So, if you log in an account that should be limited to 4 max connections and then log in 3 accounts that are limited to 3 max, will the 4th account be able to login even though it is only individually set to allot 3 max? I am sure that if you log in 3 accounts that should be limited to 3 max and then log in a 4th that is limited to 4 max, the 4th should be able to connect without a problem.

I will test this out and report back lol. I don't think not knowing how to program is helping me, but I think the worst part is figuring out the logic of the flow process it should be using and how to handle every possible scenario :P
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 09-23-2008 at 03:12 PM..
Reply With Quote
  #3  
Old 09-23-2008, 08:26 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Well, I couldn't get my code working at all. It was limiting them to 1 char max no matter what.

But, I added Derision's code and it at least works the way I was wanting it to work

It would be nice to eventually add in the optional check to see of a character is already logged on for an account and boot the character if another character on that same account tries to log on. But, that would be a separate code than the IP limiting. It would also be nice to eventually try to get the new IP Limiting feature to allow the number of allowed accounts to encrement depending on how high the account status is above the AddMaxClientsStatus setting. That is what I was trying to do with the last code I submitted above that isn't working heh.

HUGE thanks, Derision!
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 02:37 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3