ObjFW  Diff

Differences From Artifact [ae35beffef]:

To Artifact [60c85e14ca]:


65
66
67
68
69
70
71
72


73
74
75
76
77
78
79
65
66
67
68
69
70
71

72
73
74
75
76
77
78
79
80







-
+
+








- (size_t)_readNBytes: (size_t)size
	   intoBuffer: (char*)buf
{
	ssize_t ret;

	if (sock == INVALID_SOCKET)
		@throw [OFNotConnectedException newWithClass: isa];
		@throw [OFNotConnectedException newWithClass: isa
						      socket: self];

	if (eos) {
		OFReadFailedException *e;

		e = [OFReadFailedException newWithClass: isa
					  requestedSize: size];
#ifndef _WIN32
97
98
99
100
101
102
103
104


105
106
107
108
109
110
111
98
99
100
101
102
103
104

105
106
107
108
109
110
111
112
113







-
+
+








- (size_t)_writeNBytes: (size_t)size
	    fromBuffer: (const char*)buf
{
	ssize_t ret;

	if (sock == INVALID_SOCKET)
		@throw [OFNotConnectedException newWithClass: isa];
		@throw [OFNotConnectedException newWithClass: isa
						      socket: self];

	if (eos) {
		OFWriteFailedException *e;

		e = [OFWriteFailedException newWithClass: isa
					   requestedSize: size];
#ifndef _WIN32
140
141
142
143
144
145
146
147


148
149
150
151
152
153
154








155
142
143
144
145
146
147
148

149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166







-
+
+







+
+
+
+
+
+
+
+

{
	return sock;
}

- (void)close
{
	if (sock == INVALID_SOCKET)
		@throw [OFNotConnectedException newWithClass: isa];
		@throw [OFNotConnectedException newWithClass: isa
						      socket: self];

	close(sock);

	sock = INVALID_SOCKET;
	eos = NO;
	listening = NO;
}

- (void)dealloc
{
	if (sock != INVALID_SOCKET)
		[self close];

	[super dealloc];
}
@end