ObjFW  Check-in [71f54d7bb6]

Overview
Comment:OFAlreadyConnectedException: Make socket optional.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 71f54d7bb6236c617c8fb56ada9619389ca8e6c502dccefdf53fa9db51f736b8
User & Date: js on 2013-06-23 11:28:02
Other Links: manifest | tags
Context
2013-06-23
14:15
Improve OFAddressTranslationFailedException. check-in: 3f74e4c5df user: js tags: trunk
11:28
OFAlreadyConnectedException: Make socket optional. check-in: 71f54d7bb6 user: js tags: trunk
2013-06-22
12:12
Rework exceptions. check-in: 3d16a30f41 user: js tags: trunk
Changes

Modified src/exceptions/OFAlreadyConnectedException.m from [c3c77169a0] to [19c0342b16].

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

63
64
65



66
67
68
69
70
71
72

@implementation OFAlreadyConnectedException
+ (instancetype)exceptionWithSocket: (OFTCPSocket*)socket
{
	return [[[self alloc] initWithSocket: socket] autorelease];
}

- init
{
	@try {
		[self doesNotRecognizeSelector: _cmd];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	abort();
}

- initWithSocket: (OFTCPSocket*)socket
{
	self = [super init];

	_socket = [socket retain];

	return self;
}

- (void)dealloc
{
	[_socket release];

	[super dealloc];
}

- (OFString*)description
{

	return [OFString stringWithFormat:
	    @"The socket of type %@ is already connected or bound and thus "
	    @"can't be connected or bound again!", [_socket class]];



}

- (OFTCPSocket*)socket
{
	OF_GETTER(_socket, false)
}
@end







<
<
<
<
<
<
<
<
<
<
<
<


















>
|
|
|
>
>
>







26
27
28
29
30
31
32












33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

@implementation OFAlreadyConnectedException
+ (instancetype)exceptionWithSocket: (OFTCPSocket*)socket
{
	return [[[self alloc] initWithSocket: socket] autorelease];
}













- initWithSocket: (OFTCPSocket*)socket
{
	self = [super init];

	_socket = [socket retain];

	return self;
}

- (void)dealloc
{
	[_socket release];

	[super dealloc];
}

- (OFString*)description
{
	if (_socket)
		return [OFString stringWithFormat:
		    @"The socket of type %@ is already connected or bound and "
		    @"thus can't be connected or bound again!",
		    [_socket class]];
	else
		return @"A connection has already been established!";
}

- (OFTCPSocket*)socket
{
	OF_GETTER(_socket, false)
}
@end