ObjFW  Check-in [60cb25ab50]

Overview
Comment:Minor fixes (missing ifdefs, etc.)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 60cb25ab5032819d18955c1ef8c01d0c8ba9fa1df3892afff4127370fab483aa
User & Date: js on 2014-01-31 13:07:27
Other Links: manifest | tags
Context
2014-01-31
13:33
Make sure there's always an #else in abstractions check-in: 0a8dca300b user: js tags: trunk
13:07
Minor fixes (missing ifdefs, etc.) check-in: 60cb25ab50 user: js tags: trunk
2014-01-30
22:02
OFUDPSocket: Add async resolve / receive check-in: ff3c507941 user: js tags: trunk
Changes

Modified src/OFUDPSocket.h from [b1471e0ef4] to [5e54f25dd2].

28
29
30
31
32
33
34

35
36
37
38
39
40
41
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42







+







 * @brief A struct which represents a host / port pair for a UDP socket.
 */
typedef struct {
	struct sockaddr_storage address;
	socklen_t length;
} of_udp_socket_address_t;

#ifdef OF_HAVE_BLOCKS
/*!
 * @brief A block which is called when the host / port pair for the UDP socket
 *	  has been resolved.
 *
 * @param host The host that has been resolved
 * @param port The port of the host / port pair
 * @param address The address of the resolved host / port pair
55
56
57
58
59
60
61

62
63
64
65
66
67
68
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70







+







 * @param exception An exception which occurred while receiving or nil on
 *		    success
 * @return A bool whether the same block should be used for the next receive
 */
typedef bool (^of_udp_socket_async_receive_block_t)(OFUDPSocket *socket,
    void *buffer, size_t length, of_udp_socket_address_t sender,
    OFException *exception);
#endif

/*!
 * @brief A class which provides functions to create and use UDP sockets.
 *
 * Addresses are of type @ref of_udp_socket_address_t. You can use @ref
 * getHost:andPort:forAddress: to create an address for a host / port pair and
 * @ref getHost:andPort:forAddress: to get the host / port pair for an address.

Modified src/OFUDPSocket.m from [4a64bf06a1] to [851d26fee8].

131
132
133
134
135
136
137
138
139

140
141
142
143
144
145
146
131
132
133
134
135
136
137

138
139
140
141
142
143
144
145
146







-

+







- (void)didResolve
{
	[self join];

# ifdef OF_HAVE_BLOCKS
	if (_block != NULL)
		_block(_host, _port, _address, _exception);
# endif
	else {
# endif
		void (*func)(id, SEL, OFString*, uint16_t,
		    of_udp_socket_address_t, OFException*) =
		    (void(*)(id, SEL, OFString*, uint16_t,
		    of_udp_socket_address_t, OFException*))[_target
		    methodForSelector: _selector];

		func(_target, _selector, _host, _port, _address, _exception);

Modified src/resolver.m from [5111ebd364] to [028e90eddf].

259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
259
260
261
262
263
264
265


266
267
268
269
270
271
272







-
-







		*port = OF_BSWAP16_IF_LE(
		    ((struct sockaddr_in*)(void*)address)->sin_port);

# if OF_HAVE_THREADS
	if (!of_mutex_unlock(&mutex))
		@throw [OFUnlockFailedException exception];
# endif

	return ret;
#endif
}

void
of_resolver_free(of_resolver_result_t **results)
{
#ifdef HAVE_THREADSAFE_GETADDRINFO