ObjFW  Check-in [7d05cee843]

Overview
Comment:Fix 2 FIXMEs in OFTCPSocket.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7d05cee84316418644c1157abac0688a7799459420e236be763e9462890095d6
User & Date: js on 2008-12-13 14:52:05
Other Links: manifest | tags
Context
2008-12-13
15:08
One new exception; fix one FIXME in OFTCPSocket. check-in: b5ea1b43c4 user: js tags: trunk
14:52
Fix 2 FIXMEs in OFTCPSocket. check-in: 7d05cee843 user: js tags: trunk
14:50
Add missing const for some return types; new exception. check-in: 46b770d066 user: js tags: trunk
Changes

Modified src/OFTCPSocket.m from [275bdc16df] to [0fd4ca4245].

69
70
71
72
73
74
75
76
77
78
79


80
81
82
83
84
85
86

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;

	snprintf(portstr, 6, "%d", port);

	if (getaddrinfo(host, portstr, &hints, &res0)) {
		/* FIXME: Throw exception */
		return nil;
	}



	for (res = res0; res != NULL; res = res->ai_next) {
		if ((sock = socket(res->ai_family, res->ai_socktype,
		    res->ai_protocol)) < 0)
			continue;

		if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) {







|
|
|
<
>
>







69
70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86
87

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;

	snprintf(portstr, 6, "%d", port);

	if (getaddrinfo(host, portstr, &hints, &res0))
		@throw [OFAddressTranslationFailedException
		    newWithObject: self

			  andNode: host
		       andService: portstr];

	for (res = res0; res != NULL; res = res->ai_next) {
		if ((sock = socket(res->ai_family, res->ai_socktype,
		    res->ai_protocol)) < 0)
			continue;

		if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) {
122
123
124
125
126
127
128
129
130
131
132


133
134
135
136
137
138
139

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = family;
	hints.ai_socktype = SOCK_STREAM;

	snprintf(portstr, 6, "%d", port);

	if (getaddrinfo(host, portstr, &hints, &res)) {
		/* FIXME: Throw exception */
		return nil;
	}



	if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {
		/* FIXME: Throw exception */
		freeaddrinfo(res);
		return nil;
	}








|
|
|
<
>
>







123
124
125
126
127
128
129
130
131
132

133
134
135
136
137
138
139
140
141

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = family;
	hints.ai_socktype = SOCK_STREAM;

	snprintf(portstr, 6, "%d", port);

	if (getaddrinfo(host, portstr, &hints, &res))
		@throw [OFAddressTranslationFailedException
		    newWithObject: self

			  andNode: host
		       andService: portstr];

	if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {
		/* FIXME: Throw exception */
		freeaddrinfo(res);
		return nil;
	}