Browse Source

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

MissValeska 10 years ago
parent
commit
ec70f4cb47
2 changed files with 14 additions and 9 deletions
  1. 12
    7
      src/inet.c
  2. 2
    2
      src/netsukuku.c

+ 12
- 7
src/inet.c View File

1053
 	ssize_t err;
1053
 	ssize_t err;
1054
 	fd_set fdset;
1054
 	fd_set fdset;
1055
 	int ret;
1055
 	int ret;
1056
-	int errno_int;
1057
-
1056
+        
1057
+        error("Socket: %i Data: %p Data Length: %u Flags: %i Address: %p Address Length: %u", s, msg, len, flags, to, tolen);
1058
+        
1058
 	if((err=sendto(s, msg, len, flags, to, tolen))==-1) {
1059
 	if((err=sendto(s, msg, len, flags, to, tolen))==-1) {
1059
-		errno_int = errno;
1060
 		error("sendto errno: %d err is: %d", errno, err);
1060
 		error("sendto errno: %d err is: %d", errno, err);
1061
-		switch(errno_int)
1061
+		switch(errno)
1062
 		{
1062
 		{
1063
 			case EMSGSIZE:
1063
 			case EMSGSIZE:
1064
 			error("Packet artificially fragmented: %d", stderr);
1064
 			error("Packet artificially fragmented: %d", stderr);
1065
-				inet_sendto(s, msg, len/2, flags, to, tolen);
1066
-				err=inet_sendto(s, ((const char *)msg+(len/2)),
1067
-						len-(len/2), flags, to, tolen);
1065
+                                error("\nData Length: %u", len);
1066
+                                int bytesleft = len;
1067
+                                while(bytesleft > 1024) {
1068
+                                inet_sendto(s, msg, 1024, flags, to, tolen);
1069
+                                bytesleft -= 1024;
1070
+				//err=inet_sendto(s, ((const char *)msg+(len/2)),
1071
+						//len-(len/2), flags, to, tolen);
1072
+                                }
1068
 				break;
1073
 				break;
1069
 			case EFAULT:
1074
 			case EFAULT:
1070
 			error("The value of to is: %d", to);
1075
 			error("The value of to is: %d", to);

+ 2
- 2
src/netsukuku.c View File

367
                             if(is_ntkd_already_running() == 1){
367
                             if(is_ntkd_already_running() == 1){
368
                             char process_name[256] = {0};
368
                             char process_name[256] = {0};
369
                             pid_t pid;
369
                             pid_t pid;
370
-                            printf("...Shutting down ntkd...\n");
370
+                            printf("...Closing ntkd...\n");
371
                             FILE *fd=fopen(server_opt.pid_file, "r");
371
                             FILE *fd=fopen(server_opt.pid_file, "r");
372
                             while(fscanf(fd, "%s %d", process_name, &pid)!=EOF) {
372
                             while(fscanf(fd, "%s %d", process_name, &pid)!=EOF) {
373
                                     if(strcmp(process_name, "ntkd") == 0) {
373
                                     if(strcmp(process_name, "ntkd") == 0) {
374
-                                    kill(pid, SIGKILL);
374
+                                    kill(pid, SIGINT);
375
                                         }
375
                                         }
376
                                     }
376
                                     }
377
                                     fclose(fd);
377
                                     fclose(fd);

Loading…
Cancel
Save