@@ -67,11 +67,12 @@ 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 @@ -99,11 +100,12 @@ 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 @@ -142,14 +144,23 @@ } - (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