ObjFW  Diff

Differences From Artifact [d2e763431e]:

To Artifact [c248fb563e]:

  • File src/OFStreamSocket.m — part of check-in [b4cd87cd81] at 2017-05-21 23:57:34 on branch trunk — Use closesocket() instead of close()

    Previously, socket_helpers.h would just define close() to whatever is
    needed to close a socket. However, this makes it possible to
    accidentally call a socket-specific close on something that is not a
    socket. Having to explicitly call closesocket() (and defining it to
    close() on platforms where it's the same) prevents this. (user: js, size: 3980) [annotate] [blame] [check-ins using]


165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
}

- (void)close
{
	if (_socket == INVALID_SOCKET)
		@throw [OFNotOpenException exceptionWithObject: self];

	close(_socket);
	_socket = INVALID_SOCKET;

	_atEndOfStream = false;

	[super close];
}








|







165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
}

- (void)close
{
	if (_socket == INVALID_SOCKET)
		@throw [OFNotOpenException exceptionWithObject: self];

	closesocket(_socket);
	_socket = INVALID_SOCKET;

	_atEndOfStream = false;

	[super close];
}