Fasten quitting l2tp game
Drop routes as quickly as possible to lose as few packets as possible in the meanwhile.
This commit is contained in:
parent
0ac498d7d3
commit
a22295d804
3 changed files with 105 additions and 16 deletions
24
cluster.c
24
cluster.c
|
|
@ -435,8 +435,7 @@ static void send_heartbeat(int seq, uint8_t *data, int size)
|
|||
if (size > sizeof(past_hearts[0].data))
|
||||
{
|
||||
LOG(0, 0, 0, "Tried to heartbeat something larger than the maximum packet!\n");
|
||||
kill(0, SIGTERM);
|
||||
exit(1);
|
||||
crash();
|
||||
}
|
||||
i = seq % HB_HISTORY_SIZE;
|
||||
past_hearts[i].seq = seq;
|
||||
|
|
@ -903,8 +902,7 @@ static int hb_add_type(uint8_t **p, int type, int id)
|
|||
break;
|
||||
default:
|
||||
LOG(0, 0, 0, "Found an invalid type in heart queue! (%d)\n", type);
|
||||
kill(0, SIGTERM);
|
||||
exit(1);
|
||||
crash();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -951,8 +949,7 @@ void cluster_heartbeat()
|
|||
|
||||
if (p > (buff + sizeof(buff))) { // Did we somehow manage to overun the buffer?
|
||||
LOG(0, 0, 0, "FATAL: Overran the heartbeat buffer! This is fatal. Exiting. (size %d)\n", (int) (p - buff));
|
||||
kill(0, SIGTERM);
|
||||
exit(1);
|
||||
crash();
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -1011,8 +1008,7 @@ void cluster_heartbeat()
|
|||
// Did we do something wrong?
|
||||
if (p > (buff + sizeof(buff))) { // Did we somehow manage to overun the buffer?
|
||||
LOG(0, 0, 0, "Overran the heartbeat buffer now! This is fatal. Exiting. (size %d)\n", (int) (p - buff));
|
||||
kill(0, SIGTERM);
|
||||
exit(1);
|
||||
crash();
|
||||
}
|
||||
|
||||
LOG(4, 0, 0, "Sending v%d heartbeat #%d, change #%" PRIu64 " with %d changes "
|
||||
|
|
@ -1960,8 +1956,7 @@ static int cluster_process_heartbeat(uint8_t *data, int size, int more, uint8_t
|
|||
LOG(0, 0, 0, "They've seen more state changes (%" PRIu64 " vs my %" PRIu64 ") so I'm gone!\n",
|
||||
h->table_version, config->cluster_table_version);
|
||||
|
||||
kill(0, SIGTERM);
|
||||
exit(1);
|
||||
crash();
|
||||
}
|
||||
|
||||
if (h->table_version < config->cluster_table_version)
|
||||
|
|
@ -1969,8 +1964,7 @@ static int cluster_process_heartbeat(uint8_t *data, int size, int more, uint8_t
|
|||
|
||||
if (basetime > h->basetime) {
|
||||
LOG(0, 0, 0, "They're an older master than me so I'm gone!\n");
|
||||
kill(0, SIGTERM);
|
||||
exit(1);
|
||||
crash();
|
||||
}
|
||||
|
||||
if (basetime < h->basetime)
|
||||
|
|
@ -1978,8 +1972,7 @@ static int cluster_process_heartbeat(uint8_t *data, int size, int more, uint8_t
|
|||
|
||||
if (my_address < addr) { // Tie breaker.
|
||||
LOG(0, 0, 0, "They're a higher IP address than me, so I'm gone!\n");
|
||||
kill(0, SIGTERM);
|
||||
exit(1);
|
||||
crash();
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -2366,8 +2359,7 @@ int processcluster(uint8_t *data, int size, in_addr_t addr)
|
|||
}
|
||||
|
||||
LOG(0, 0, 0, "Received a valid C_KILL: I'm going to die now.\n");
|
||||
kill(0, SIGTERM);
|
||||
exit(0); // Lets be paranoid;
|
||||
crash();
|
||||
return -1; // Just signalling the compiler.
|
||||
|
||||
case C_HEARTBEAT:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue