AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Server hangs at startup due to hltv socket (https://forums.alliedmods.net/showthread.php?t=132040)

sparkey 07-11-2010 08:51

Server hangs at startup due to hltv socket
 
Hi,

hlds cstrike crashes at startup when connecting to a hltv through socket_open.

hlds starts up just fine as long as i dont have the hltv process running on the remote server. As soon as i start it and try to start hlds the server just hangs right after mapchange when it starts connecting to the hltv.

here is the amxx code im using

PHP Code:

#define HLTV                    "1.2.3.4"

new hltv_port;
new 
hltv_stat;
hltv_port FETCHING_A_PORT_FROM_MYSQL;

public 
hltv_reset()
{
    new 
socket 0;
    new 
error;
    new 
rconid[13];
    new 
rcv[256];
    new 
snd[256];
    new 
rconPass[32];

    
// Connect to server
    
socket socket_open(HLTVhltv_portSOCKET_UDPerror);
    if (
error != 0)
    {
        
server_print("[%s]%s HLTV Record :: Connection to HLTV %s:%s failed.",log_time(), SERVER_PREFIXHLTVhltv_port);
    } else {

    
//send challenge rcon and receive response
    
setc(snd,4,0xff);
    
copy(snd[4],255,"challenge rcon");
    
setc(snd[18],1,'^n');
    
socket_send(socket,snd,255);
    
socket_recv(socket,rcv,255);

    
// get rcon challenge number from response
    
copy(rconid,12,rcv[19]);
    
replace(rconid,255,"^n","");
    
rconPass "asdasd";

    
// set rcon command
    
setc(snd,255,0x00);
    
setc(snd,4,0xff);
    
format(snd[4],255,"rcon %s %s  stoprecording",rconid,rconPass);

    
// send rcon command and close socket
    
socket_send(socket,snd,255);
    
socket_close(socket);


No logs or anything :/

Thankful for all the help i can get on this issue.

sparkey 07-11-2010 10:50

Re: Server crash at startup due to hltv socket
 
After some commenting in the code it seems that the following row makes the server hang.

PHP Code:

socket_recv(socket,rcv,255); 

Any ideas?


All times are GMT -4. The time now is 07:06.

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