diff --git a/src/inet.c b/src/inet.c index 158d2b4..d79b268 100644 --- a/src/inet.c +++ b/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); diff --git a/src/netsukuku.c b/src/netsukuku.c index 66d49fc..08541b9 100644 --- a/src/netsukuku.c +++ b/src/netsukuku.c @@ -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);