mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-29 16:14:43 +00:00
SERVERSILENCETIMEOUT
This commit is contained in:
3
VERSIONS
3
VERSIONS
@@ -1,5 +1,6 @@
|
||||
3.1 -- WORK IN PROGRESS (~April, 2018)
|
||||
3.1 -- WORK IN PROGRESS (~May, 2018)
|
||||
|
||||
* Added: SERVERSILENCETIMEOUT, maximum idle timer for server connection. in case of lost FIN packets
|
||||
* Fixed: Compiles clean with -std=c89
|
||||
* Added: $guid to esay variables
|
||||
* Added: New bigsay font: spider, use with .bigsay -spider cowabunga!
|
||||
|
||||
@@ -1106,7 +1106,7 @@ void update(SequenceTime *this)
|
||||
/*
|
||||
* Read data from server socket
|
||||
*/
|
||||
void parse_server_input(void)
|
||||
void process_server_input(void)
|
||||
{
|
||||
#ifdef WINGATE
|
||||
Server *sp;
|
||||
@@ -1190,7 +1190,8 @@ get_line:
|
||||
}
|
||||
}
|
||||
#endif /* WINGATE */
|
||||
parseline(linebuf);
|
||||
current->conntry = now;
|
||||
parse_server_input(linebuf);
|
||||
goto get_line;
|
||||
}
|
||||
switch(errno)
|
||||
|
||||
@@ -334,6 +334,8 @@ enum {
|
||||
#define CN_WINGATEWAIT 8
|
||||
#define CN_SPINNING 9 /* after exhausting serverlist */
|
||||
|
||||
#define SERVERSILENCETIMEOUT 360 /* server connection idle timeout */
|
||||
|
||||
/* DCC Kill flags (BYE command) */
|
||||
|
||||
#define DCC_NULL 0
|
||||
|
||||
4
src/h.h
4
src/h.h
@@ -196,7 +196,7 @@ void register_with_server(void);
|
||||
int sub_compile_timer(int, uint32_t *, uint32_t *, char *);
|
||||
int compile_timer(HookTimer *, char *);
|
||||
void update(SequenceTime *this);
|
||||
void parse_server_input(void);
|
||||
void process_server_input(void);
|
||||
void do_version(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_core(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_die(COMMAND_ARGS) __page(RARE_SEG);
|
||||
@@ -533,7 +533,7 @@ LS void parse_348(char *from, char *rest);
|
||||
LS void parse_368(char *from, char *rest);
|
||||
LS void parse_005(char *from, char *rest);
|
||||
LS uint32_t stringhash(char *s);
|
||||
LS void parseline(char *rest);
|
||||
LS void parse_server_input(char *rest);
|
||||
|
||||
/* partyline.c */
|
||||
|
||||
|
||||
14
src/main.c
14
src/main.c
@@ -780,10 +780,22 @@ restart_dcc:
|
||||
process_dcc();
|
||||
|
||||
if (current->sock != -1)
|
||||
parse_server_input();
|
||||
process_server_input();
|
||||
|
||||
if (current->connect == CN_ONLINE)
|
||||
{
|
||||
/*
|
||||
* Its possible to get stuck waiting forever if a FIN packet is lost
|
||||
* unless you do this...
|
||||
*/
|
||||
if ((current->conntry - now) > SERVERSILENCETIMEOUT)
|
||||
{
|
||||
to_server("PING :%lu\n",now);
|
||||
current->conntry += 10; /* send more unless an answer is received in <10 seconds */
|
||||
}
|
||||
/*
|
||||
* Keep server idle-timer low to seem like you are chatting
|
||||
*/
|
||||
if (current->setting[TOG_NOIDLE].int_var)
|
||||
{
|
||||
if ((now - current->lastantiidle) > PINGSENDINTERVAL)
|
||||
|
||||
@@ -1459,7 +1459,7 @@ uint32_t stringhash(char *s)
|
||||
return(hash);
|
||||
}
|
||||
|
||||
void parseline(char *rest)
|
||||
void parse_server_input(char *rest)
|
||||
{
|
||||
#ifdef SCRIPTING
|
||||
Hook *hook;
|
||||
|
||||
@@ -578,6 +578,7 @@ typedef struct Mech
|
||||
#endif /* CHANBAN */
|
||||
|
||||
time_t conntry; /* when connect try started */
|
||||
/* re-used for server activity once connected */
|
||||
time_t activity; /* Away timer (AAWAY) */
|
||||
|
||||
time_t ontime; /* how long the bot has been connected */
|
||||
|
||||
@@ -169,7 +169,7 @@ void send_uptime(int type)
|
||||
if (botlist)
|
||||
{
|
||||
nick = botlist->nick;
|
||||
upPack.ontime = htonl(botlist->conntry);
|
||||
upPack.ontime = htonl(botlist->ontime);
|
||||
if ((sp = find_server(botlist->server)))
|
||||
{
|
||||
server = (*sp->realname) ? sp->realname : sp->name;
|
||||
|
||||
Reference in New Issue
Block a user