Selaa lähdekoodia

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 vuotta sitten
vanhempi
commit
ec70f4cb47
2 muutettua tiedostoa jossa 14 lisäystä ja 9 poistoa
  1. 12
    7
      src/inet.c
  2. 2
    2
      src/netsukuku.c

+ 12
- 7
src/inet.c Näytä tiedosto

@@ -1053,18 +1053,23 @@ ssize_t inet_sendto(int s, const void *msg, size_t len, int flags,
1053 1053
 	ssize_t err;
1054 1054
 	fd_set fdset;
1055 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 1059
 	if((err=sendto(s, msg, len, flags, to, tolen))==-1) {
1059
-		errno_int = errno;
1060 1060
 		error("sendto errno: %d err is: %d", errno, err);
1061
-		switch(errno_int)
1061
+		switch(errno)
1062 1062
 		{
1063 1063
 			case EMSGSIZE:
1064 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 1073
 				break;
1069 1074
 			case EFAULT:
1070 1075
 			error("The value of to is: %d", to);

+ 2
- 2
src/netsukuku.c Näytä tiedosto

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

Loading…
Peruuta
Tallenna