Differences From Artifact [bbb2f277d7]:
- File
src/OFDatagramSocket.m
— part of check-in
[25adea9a23]
at
2022-08-06 21:14:31
on branch trunk
— Don't use struct sockaddr in OFSocketAddress
struct sockaddr can contain a variable length array, which breaks the
union. (user: js, size: 9029) [annotate] [blame] [check-ins using] [more...]
To Artifact [ea19c6b109]:
- File src/OFDatagramSocket.m — part of check-in [6ed8be900e] at 2022-11-06 20:31:24 on branch trunk — OFDatagramSocket: Make sender nullable (user: js, size: 9323) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
169 170 171 172 173 174 175 | sender: (OFSocketAddress *)sender { ssize_t ret; if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; | > | | > | > > | | | | | | | | | | | | | > > > > > | | | > | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | sender: (OFSocketAddress *)sender { ssize_t ret; if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; if (sender != NULL) sender->length = (socklen_t)sizeof(sender->sockaddr); #ifndef OF_WINDOWS if ((ret = recvfrom(_socket, buffer, length, 0, (sender != NULL ? (struct sockaddr *)&sender->sockaddr : NULL), (sender != NULL ? &sender->length : NULL))) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: OFSocketErrNo()]; #else if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if ((ret = recvfrom(_socket, buffer, (int)length, 0, (sender != NULL ? (struct sockaddr *)&sender->sockaddr : NULL), (sender != NULL ? &sender->length : NULL))) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: OFSocketErrNo()]; #endif if (sender != NULL) { switch (((struct sockaddr *)&sender->sockaddr)->sa_family) { case AF_INET: sender->family = OFSocketAddressFamilyIPv4; break; #ifdef OF_HAVE_IPV6 case AF_INET6: sender->family = OFSocketAddressFamilyIPv6; break; #endif #ifdef OF_HAVE_UNIX_SOCKETS case AF_UNIX: sender->family = OFSocketAddressFamilyUNIX; break; #endif #ifdef OF_HAVE_IPX case AF_IPX: sender->family = OFSocketAddressFamilyIPX; break; #endif #ifdef OF_HAVE_APPLETALK case AF_APPLETALK: sender->family = OFSocketAddressFamilyAppleTalk; break; #endif default: sender->family = OFSocketAddressFamilyUnknown; break; } } return ret; } - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length { |
︙ | ︙ |