Browse Source

This should fix the packet artifically fragmented errors, Hopefully.

MissValeska 10 years ago
parent
commit
06de3f1f9e
1 changed files with 7 additions and 15 deletions
  1. 7
    15
      src/inet.c

+ 7
- 15
src/inet.c View File

@@ -1062,6 +1062,7 @@ inet_send(int s, const void *msg, size_t len, int flags)
1062 1062
 				inet_send(s, msg, len/2, flags);
1063 1063
 				err=inet_send(s, (const char *)msg+(len/2),
1064 1064
 						len-(len/2), flags);
1065
+                                error("\nEMSGSIZE inet_send testing.\n");
1065 1066
 				break;
1066 1067
 
1067 1068
 			default:
@@ -1109,15 +1110,14 @@ inet_sendto(int s, const void *msg, size_t len, int flags,
1109 1110
 			const struct sockaddr * to, socklen_t tolen)
1110 1111
 {
1111 1112
 	ssize_t err;
1112
-
1113
+        /* How are these last two arguments used when the function being called
1114
+         * doesn't have those arguments? */
1113 1115
 	if ((err = sendto(s, msg, len, flags, to, tolen)) == -1) {
1114 1116
 		error("sendto errno: %d err is: %d", errno, err);
1115 1117
 		switch (errno) {
1116 1118
 		case EMSGSIZE:
1117 1119
 			error("Packet artificially fragmented: %d", stderr);
1118 1120
 			error("\nData Length: %u", len);
1119
-			int bytesleft = len;
1120
-			int sendbuf;
1121 1121
 			socklen_t optlen;
1122 1122
 			optlen = sizeof(sendbuf);
1123 1123
 			int res =
@@ -1125,18 +1125,10 @@ inet_sendto(int s, const void *msg, size_t len, int flags,
1125 1125
 
1126 1126
 			error("GetSockOpt: %i \n", res);
1127 1127
 
1128
-			while (bytesleft != 0) {
1129
-				if (bytesleft > 64000) {
1130
-					inet_sendto(s, msg, 64000, flags, to, tolen);
1131
-					bytesleft -= 64000;
1132
-					msg += 64000;
1133
-					//err=inet_sendto(s, ((const char *)msg+(len/2)),
1134
-					//len-(len/2), flags, to, tolen);
1135
-				} else {
1136
-					err = inet_sendto(s, msg, bytesleft, flags, to, tolen);
1137
-					bytesleft = 0;
1138
-				}
1139
-			}
1128
+				inet_send(s, msg, len/2, flags);
1129
+				err=inet_send(s, (const char *)msg+(len/2),
1130
+						len-(len/2), flags);
1131
+                                error("\nEMSGSIZE inet_sendto testing.\n");
1140 1132
 			break;
1141 1133
 		case EFAULT:
1142 1134
 			error("The value of to is: %d", to);

Loading…
Cancel
Save