ObjFW  Diff

Differences From Artifact [8eaed27d7d]:

To Artifact [2642e89679]:


144
145
146
147
148
149
150
151

152
153
154
155
156
157
158
144
145
146
147
148
149
150

151
152
153
154
155
156
157
158







-
+







		     context: (id)context
		   exception: (id)exception;
@end

@interface OFTCPSocket_ConnectContext: OFObject
{
@public
	bool _connected;
	bool _done;
	id _exception;
}

- (void)socketDidConnect: (OFTCPSocket *)sock
		 context: (id)context
	       exception: (id)exception;
@end
653
654
655
656
657
658
659
660
661

662
663

664
665
666
667
668
669
670
653
654
655
656
657
658
659


660


661
662
663
664
665
666
667
668







-
-
+
-
-
+







	[super dealloc];
}

- (void)socketDidConnect: (OFTCPSocket *)sock
		 context: (id)context
	       exception: (id)exception
{
	if (exception != nil)
		_exception = [exception retain];
	_exception = [exception retain];

	_connected = true;
	_done = true;
}
@end

@implementation OFTCPSocket
@synthesize SOCKS5Host = _SOCKS5Host, SOCKS5Port = _SOCKS5Port;

+ (void)setSOCKS5Host: (OFString *)host
779
780
781
782
783
784
785
786

787
788
789
790
791
792
793
777
778
779
780
781
782
783

784
785
786
787
788
789
790
791







-
+







	[self asyncConnectToHost: host
			    port: port
		     runLoopMode: connectRunLoopMode
			  target: context
			selector: @selector(socketDidConnect:context:exception:)
			 context: nil];

	while (!context->_connected)
	while (!context->_done)
		[runLoop runMode: connectRunLoopMode
		      beforeDate: nil];

	/* Cleanup */
	[runLoop runMode: connectRunLoopMode
	      beforeDate: [OFDate date]];