ObjFW  Check-in [5f8070d792]

Overview
Comment:OFSCTPSocket: Fix setting SCTP_UNORDERED

This worked by pure coincidence since true and SCTP_UNORDERED are both
1 on Linux.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5f8070d79252d0132e44a66c909f9135eb86c8bed84207140928fdd44f815455
User & Date: js on 2024-05-04 20:21:38
Other Links: manifest | tags
Context
2024-05-04
20:51
Update GitHub issue template check-in: 51917aaa94 user: js tags: trunk
20:21
OFSCTPSocket: Fix setting SCTP_UNORDERED check-in: 5f8070d792 user: js tags: trunk
20:06
Add support for SCTP sockets check-in: fef7240652 user: js tags: trunk
Changes

Modified src/OFRunLoop.m from [f56fb160b7] to [fbc3913f1e].

651
652
653
654
655
656
657
658
659
660
661

662
663
664
665
666
667
668
# ifdef OF_HAVE_BLOCKS
	}
# endif
}

- (void)dealloc
{
	[_data release];
# ifdef OF_HAVE_BLOCKS
	[_block release];
# endif


	[super dealloc];
}
@end

@implementation OFRunLoopWriteStringQueueItem
- (bool)handleObject: (id)object







<



>







651
652
653
654
655
656
657

658
659
660
661
662
663
664
665
666
667
668
# ifdef OF_HAVE_BLOCKS
	}
# endif
}

- (void)dealloc
{

# ifdef OF_HAVE_BLOCKS
	[_block release];
# endif
	[_data release];

	[super dealloc];
}
@end

@implementation OFRunLoopWriteStringQueueItem
- (bool)handleObject: (id)object
920
921
922
923
924
925
926
927
928
929
930

931
932
933
934
935
936
937
# ifdef OF_HAVE_BLOCKS
	}
# endif
}

- (void)dealloc
{
	[_data release];
# ifdef OF_HAVE_BLOCKS
	[_block release];
# endif


	[super dealloc];
}
@end

@implementation OFRunLoopPacketReceiveQueueItem
- (bool)handleObject: (id)object







<



>







920
921
922
923
924
925
926

927
928
929
930
931
932
933
934
935
936
937
# ifdef OF_HAVE_BLOCKS
	}
# endif
}

- (void)dealloc
{

# ifdef OF_HAVE_BLOCKS
	[_block release];
# endif
	[_data release];

	[super dealloc];
}
@end

@implementation OFRunLoopPacketReceiveQueueItem
- (bool)handleObject: (id)object
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030

1031
1032
1033
1034
1035
1036
1037
# ifdef OF_HAVE_BLOCKS
	}
# endif
}

- (void)dealloc
{
	[_data release];
# ifdef OF_HAVE_BLOCKS
	[_block release];
# endif


	[super dealloc];
}
@end

# ifdef OF_HAVE_SCTP
@implementation OFRunLoopSCTPReceiveQueueItem







<



>







1020
1021
1022
1023
1024
1025
1026

1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
# ifdef OF_HAVE_BLOCKS
	}
# endif
}

- (void)dealloc
{

# ifdef OF_HAVE_BLOCKS
	[_block release];
# endif
	[_data release];

	[super dealloc];
}
@end

# ifdef OF_HAVE_SCTP
@implementation OFRunLoopSCTPReceiveQueueItem
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137

1138
1139
1140
1141
1142
1143
1144
#  ifdef OF_HAVE_BLOCKS
	}
#  endif
}

- (void)dealloc
{
	[_data release];
# ifdef OF_HAVE_BLOCKS
	[_block release];
# endif

	[_info release];

	[super dealloc];
}
@end
# endif
#endif







<



>







1127
1128
1129
1130
1131
1132
1133

1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
#  ifdef OF_HAVE_BLOCKS
	}
#  endif
}

- (void)dealloc
{

# ifdef OF_HAVE_BLOCKS
	[_block release];
# endif
	[_data release];
	[_info release];

	[super dealloc];
}
@end
# endif
#endif

Modified src/OFSCTPSocket.m from [4453ea5c07] to [29ca29fac2].

461
462
463
464
465
466
467
468
469

470
471
472
473
474
475
476
		.iov_len = length
	};
	struct sctp_sndinfo sndinfo = {
		.snd_sid = (uint16_t)
		    [[info objectForKey: OFSCTPStreamID] unsignedShortValue],
		.snd_ppid = (uint32_t)
		    [[info objectForKey: OFSCTPPPID] unsignedLongValue],
		.snd_flags =
		    [[info objectForKey: OFSCTPUnordered] boolValue]

	};

	if (_socket == OFInvalidSocketHandle)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (length > SSIZE_MAX)
		@throw [OFOutOfRangeException exception];







<
|
>







461
462
463
464
465
466
467

468
469
470
471
472
473
474
475
476
		.iov_len = length
	};
	struct sctp_sndinfo sndinfo = {
		.snd_sid = (uint16_t)
		    [[info objectForKey: OFSCTPStreamID] unsignedShortValue],
		.snd_ppid = (uint32_t)
		    [[info objectForKey: OFSCTPPPID] unsignedLongValue],

		.snd_flags = ([[info objectForKey: OFSCTPUnordered] boolValue]
		    ? SCTP_UNORDERED : 0)
	};

	if (_socket == OFInvalidSocketHandle)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (length > SSIZE_MAX)
		@throw [OFOutOfRangeException exception];