mirror of
https://github.com/ChronosX88/netsukuku.git
synced 2024-11-29 21:52:18 +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;
|
ssize_t err;
|
||||||
fd_set fdset;
|
fd_set fdset;
|
||||||
int ret;
|
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) {
|
if((err=sendto(s, msg, len, flags, to, tolen))==-1) {
|
||||||
errno_int = errno;
|
|
||||||
error("sendto errno: %d err is: %d", errno, err);
|
error("sendto errno: %d err is: %d", errno, err);
|
||||||
switch(errno_int)
|
switch(errno)
|
||||||
{
|
{
|
||||||
case EMSGSIZE:
|
case EMSGSIZE:
|
||||||
error("Packet artificially fragmented: %d", stderr);
|
error("Packet artificially fragmented: %d", stderr);
|
||||||
inet_sendto(s, msg, len/2, flags, to, tolen);
|
error("\nData Length: %u", len);
|
||||||
err=inet_sendto(s, ((const char *)msg+(len/2)),
|
int bytesleft = len;
|
||||||
len-(len/2), flags, to, tolen);
|
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;
|
break;
|
||||||
case EFAULT:
|
case EFAULT:
|
||||||
error("The value of to is: %d", to);
|
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){
|
if(is_ntkd_already_running() == 1){
|
||||||
char process_name[256] = {0};
|
char process_name[256] = {0};
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
printf("...Shutting down ntkd...\n");
|
printf("...Closing ntkd...\n");
|
||||||
FILE *fd=fopen(server_opt.pid_file, "r");
|
FILE *fd=fopen(server_opt.pid_file, "r");
|
||||||
while(fscanf(fd, "%s %d", process_name, &pid)!=EOF) {
|
while(fscanf(fd, "%s %d", process_name, &pid)!=EOF) {
|
||||||
if(strcmp(process_name, "ntkd") == 0) {
|
if(strcmp(process_name, "ntkd") == 0) {
|
||||||
kill(pid, SIGKILL);
|
kill(pid, SIGINT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user