Raised This Month: $ Target: $400
 0% 

nVault bug?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Misery
Senior Member
Join Date: Dec 2010
Old 06-19-2012 , 09:23   nVault bug?
Reply With Quote #1

Hi,

I'm maintaining a ban vault... It's a short one, since all bans contained in it are only temporary.
I'm running down problems...

You see, I don't need to put a value in the key. So the key can be empty. In fact only timestamp and the key name are what matters.
I use nvault_touch() to set the empty key and update the timestamp to make it the an unban timestamp (i.e. time() + banlength_in_seconds). The advantage is that I can then prune the vault to remove exprired bans... based on timestamps.

However, the vault crashes miserably...
Give it a look too...

Code:
#include <amxmodx>
#include <nvault>

public plugin_init()
{
	new pvault = nvault_open("testvault");
	nvault_touch(pvault, "STEAM_0:0:56423", time() + 3600); // Will create an empty key
	nvault_close(pvault);
}
Now, add it to plugins.ini, load your hlds install. Once AMXX plugins are all loaded, type "exit" in the server console. Repeat once and you will get a nice crash...

Do I miss something?

Cordially,
Misery

Last edited by Misery; 06-19-2012 at 09:26.
Misery is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-19-2012 , 18:09   Re: nVault bug?
Reply With Quote #2

Why don't you use the ID as the key (who you want to ban) the touch as the ban-begin, and the data as the ban-end. and each load you iterate and check weather the data is equal to the current time. Then delete it if it is. That way you can also have a way to find out when someone was banned-i've found a need for this many a day as an owner. This will also give you easy ways to remove bans, check bans, extend bans, and would be easier to implement as well.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
Misery
Senior Member
Join Date: Dec 2010
Old 06-20-2012 , 02:12   Re: nVault bug?
Reply With Quote #3

Well, it's an automatic ban system made for different rules breaking. Does not need really all these cosmetics. It's really only for misc. bans...

I guess nVault is a crappy implementation... crashing like that because the key is empty. Ill put some shitty value in the key string to circumvent the bug...

Still, Thank you,
Misery

Last edited by Misery; 06-20-2012 at 02:43.
Misery is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-20-2012 , 11:33   Re: nVault bug?
Reply With Quote #4

No matter what you do, unless you write your own, the persistence system you use (sQL/nVault/fVault) requires some sort of identifier for the data. Otherwise it doesn't know what its retrieving. So it crashes. Its the rules of data handling. You need some sort of hook for the data, otherwise its just data with no use to the system. Anyways....it'd be silly not to have a key, especially if you want to iterate through.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
Misery
Senior Member
Join Date: Dec 2010
Old 06-21-2012 , 03:59   Re: nVault bug?
Reply With Quote #5

No. Lots of binary vaults including ones in UNIX flavors support PERFECTLY empty keys.

The data is identified by a hash table, and the key name is retrireved through this. Not with the value inside the key, but rather with the key name.
What I told you is that only two things are important in my case:
1- Key name
2- Timestamps

I don't need to have a value assigned to the key, since the timestamp supercedes the key value in this context. Hance why I wanted empty keys (not empty key name, but a null string as the key value).

Thanks anyways for trying to help Liverwiz, but I just used a workaround... assign the character "@" to each key.

Misery

Last edited by Misery; 06-21-2012 at 04:03.
Misery is offline
Reply



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 06:13.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode