Raised This Month: $51 Target: $400
 12% 

Steam Group Whitelist 2.0


Post New Thread Reply   
 
Thread Tools Display Modes
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 07-22-2023 , 20:44   Re: Steam Group Whitelist
Reply With Quote #21

i will do some changes and update
__________________
bigdaddy424 is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 08-11-2023 , 21:42   Re: Steam Group Whitelist 2.0
Reply With Quote #22

I've updated both files and after doing some benchmark on an empty server I'm able to send and receive data to steam api instantly (0.000000s) using sockets
Credits to DJEarthQuake for providing feedback and Jhob94 for kick stock
__________________
bigdaddy424 is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 08-13-2023 , 13:58   Re: Steam Group Whitelist 2.0
Reply With Quote #23

i don't know if this is an overengineering, but what if the response won't be instantly and the data from steamapi won't be so fast as expected? that timeout in socket_is_readable will freeze the whole server
lexzor is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 08-13-2023 , 21:11   Re: Steam Group Whitelist 2.0
Reply With Quote #24

im not an expert in cpp but looking at what socket_is_readable does is that returns socket_change.
on paper, socket_change hangs the function until it gets an answer from select()
maybe someone experienced can give a detailed answer
https://github.com/alliedmodders/amx....cpp#L265-L279
PHP Code:
static cell AMX_NATIVE_CALL socket_change(AMX *amxcell *params)
{
    
int sockfd params[1];
    
unsigned int timeout params[2];

    
struct timeval tv;
    
tv.tv_sec 0;
    
tv.tv_usec timeout;

    
fd_set readfds;
    
FD_ZERO(&readfds);
    
FD_SET(sockfd, &readfds);

    return (
select(sockfd 1, &readfdsnullptrnullptr, &tv) > 0) ? 0;

__________________
bigdaddy424 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 08-14-2023 , 06:05   Re: Steam Group Whitelist 2.0
Reply With Quote #25

Quote:
Originally Posted by lexzor View Post
i don't know if this is an overengineering, but what if the response won't be instantly and the data from steamapi won't be so fast as expected? that timeout in socket_is_readable will freeze the whole server
Raise the timeout time if you want, but it should be fine as it is. And you don't need to worry about freeze the server because it only does stuff if it is readable.
__________________
Jhob94 is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 08-16-2023 , 20:10   Re: Steam Group Whitelist 2.0
Reply With Quote #26

quote from https://man7.org/linux/man-pages/man2/select.2.html
Quote:
timeout
The timeout argument is a timeval structure (shown below)
that specifies the interval that select() should block
waiting for a file descriptor to become ready. The call
will block until either:

• a file descriptor becomes ready;

• the call is interrupted by a signal handler; or

• the timeout expires.

Note that the timeout interval will be rounded up to the
system clock granularity, and kernel scheduling delays
mean that the blocking interval may overrun by a small
amount.

If both fields of the timeval structure are zero, then
select() returns immediately. (This is useful for
polling.)

If timeout is specified as NULL, select() blocks
indefinitely waiting for a file descriptor to become
ready.
---
The timeout
The timeout argument for select() is a structure of the following
type:

struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};

The corresponding argument for pselect() is a timespec(3)
structure.

On Linux, select() modifies timeout to reflect the amount of time
not slept; most other implementations do not do this. (POSIX.1
permits either behavior.) This causes problems both when Linux
code which reads timeout is ported to other operating systems,
and when code is ported to Linux that reuses a struct timeval for
multiple select()s in a loop without reinitializing it. Consider
timeout to be undefined after select() returns.
its save to say that set_task is not necessary
__________________
bigdaddy424 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 04:52.


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