mirror of
https://github.com/ChronosX88/netsukuku.git
synced 2024-11-26 04:02:19 +00:00
Changed SIGKILL to SIGINT, So Netsukuku will clean and save everything properly. I, Also, Added more stuff to inet_sendto for packet division in the case of errno 90. Still working
This commit is contained in:
parent
54195c8b76
commit
ec70f4cb47
17
src/inet.c
17
src/inet.c
@ -1053,18 +1053,23 @@ ssize_t inet_sendto(int s, const void *msg, size_t len, int flags,
|
||||
ssize_t err;
|
||||
fd_set fdset;
|
||||
int ret;
|
||||
int errno_int;
|
||||
|
||||
error("Socket: %i Data: %p Data Length: %u Flags: %i Address: %p Address Length: %u", s, msg, len, flags, to, tolen);
|
||||
|
||||
if((err=sendto(s, msg, len, flags, to, tolen))==-1) {
|
||||
errno_int = errno;
|
||||
error("sendto errno: %d err is: %d", errno, err);
|
||||
switch(errno_int)
|
||||
switch(errno)
|
||||
{
|
||||
case EMSGSIZE:
|
||||
error("Packet artificially fragmented: %d", stderr);
|
||||
inet_sendto(s, msg, len/2, flags, to, tolen);
|
||||
err=inet_sendto(s, ((const char *)msg+(len/2)),
|
||||
len-(len/2), flags, to, tolen);
|
||||
error("\nData Length: %u", len);
|
||||
int bytesleft = len;
|
||||
while(bytesleft > 1024) {
|
||||
inet_sendto(s, msg, 1024, flags, to, tolen);
|
||||
bytesleft -= 1024;
|
||||
//err=inet_sendto(s, ((const char *)msg+(len/2)),
|
||||
//len-(len/2), flags, to, tolen);
|
||||
}
|
||||
break;
|
||||
case EFAULT:
|
||||
error("The value of to is: %d", to);
|
||||
|
@ -367,11 +367,11 @@ void parse_options(int argc, char **argv)
|
||||
if(is_ntkd_already_running() == 1){
|
||||
char process_name[256] = {0};
|
||||
pid_t pid;
|
||||
printf("...Shutting down ntkd...\n");
|
||||
printf("...Closing ntkd...\n");
|
||||
FILE *fd=fopen(server_opt.pid_file, "r");
|
||||
while(fscanf(fd, "%s %d", process_name, &pid)!=EOF) {
|
||||
if(strcmp(process_name, "ntkd") == 0) {
|
||||
kill(pid, SIGKILL);
|
||||
kill(pid, SIGINT);
|
||||
}
|
||||
}
|
||||
fclose(fd);
|
||||
|
Loading…
Reference in New Issue
Block a user