This should fix the packet artifically fragmented errors, Hopefully.

This commit is contained in:
MissValeska 2014-10-21 01:04:01 -07:00
parent e6bea6b2c0
commit 06de3f1f9e

View File

@ -1062,6 +1062,7 @@ inet_send(int s, const void *msg, size_t len, int flags)
inet_send(s, msg, len/2, flags); inet_send(s, msg, len/2, flags);
err=inet_send(s, (const char *)msg+(len/2), err=inet_send(s, (const char *)msg+(len/2),
len-(len/2), flags); len-(len/2), flags);
error("\nEMSGSIZE inet_send testing.\n");
break; break;
default: default:
@ -1109,15 +1110,14 @@ inet_sendto(int s, const void *msg, size_t len, int flags,
const struct sockaddr * to, socklen_t tolen) const struct sockaddr * to, socklen_t tolen)
{ {
ssize_t err; ssize_t err;
/* How are these last two arguments used when the function being called
* doesn't have those arguments? */
if ((err = sendto(s, msg, len, flags, to, tolen)) == -1) { if ((err = sendto(s, msg, len, flags, to, tolen)) == -1) {
error("sendto errno: %d err is: %d", errno, err); error("sendto errno: %d err is: %d", errno, err);
switch (errno) { switch (errno) {
case EMSGSIZE: case EMSGSIZE:
error("Packet artificially fragmented: %d", stderr); error("Packet artificially fragmented: %d", stderr);
error("\nData Length: %u", len); error("\nData Length: %u", len);
int bytesleft = len;
int sendbuf;
socklen_t optlen; socklen_t optlen;
optlen = sizeof(sendbuf); optlen = sizeof(sendbuf);
int res = int res =
@ -1125,18 +1125,10 @@ inet_sendto(int s, const void *msg, size_t len, int flags,
error("GetSockOpt: %i \n", res); error("GetSockOpt: %i \n", res);
while (bytesleft != 0) { inet_send(s, msg, len/2, flags);
if (bytesleft > 64000) { err=inet_send(s, (const char *)msg+(len/2),
inet_sendto(s, msg, 64000, flags, to, tolen); len-(len/2), flags);
bytesleft -= 64000; error("\nEMSGSIZE inet_sendto testing.\n");
msg += 64000;
//err=inet_sendto(s, ((const char *)msg+(len/2)),
//len-(len/2), flags, to, tolen);
} else {
err = inet_sendto(s, msg, bytesleft, flags, to, tolen);
bytesleft = 0;
}
}
break; break;
case EFAULT: case EFAULT:
error("The value of to is: %d", to); error("The value of to is: %d", to);