Overview
Comment: | Add -[asyncConnectAndHandle]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
2dcf26fbc9bd8a0f126946d75bb7329f |
User & Date: | js on 2012-12-13 22:29:12 |
Other Links: | manifest | tags |
Context
2012-12-19
| ||
21:36 | Adjust to recent ObjFW changes. check-in: e33c8d554c user: js tags: trunk | |
2012-12-13
| ||
22:29 | Add -[asyncConnectAndHandle]. check-in: 2dcf26fbc9 user: js tags: trunk | |
22:09 | Make method names more consistent with ObjFW. check-in: 7f10dd9950 user: js tags: trunk | |
Changes
Modified src/XMPPConnection.h from [12411aa95c] to [77f95677ee].
︙ | |||
257 258 259 260 261 262 263 264 265 266 267 268 269 270 | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | + + + + + + | - (BOOL)checkCertificateAndGetReason: (OFString**)reason; /** * \brief Adds the connection to the run loop. */ - (void)handleConnection; /** * \brief Asynchronously connects to the server and adds the connection to the * run loop. */ - (void)asyncConnectAndHandle; /** * \brief Parses the specified buffer. * * This is useful for handling multiple connections at once. * * \param buffer The buffer to parse * \param length The length of the buffer. If length is 0, it is assumed that |
︙ |
Modified src/XMPPConnection.m from [5b10968439] to [d67ef6bb82].
︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | #import "XMPPExceptions.h" #import "XMPPXMLElementBuilder.h" #import "namespaces.h" #import <ObjFW/macros.h> #define BUFFER_LENGTH 512 @interface XMPPConnection_ConnectThread: OFThread { OFThread *sourceThread; XMPPConnection *connection; } - initWithSourceThread: (OFThread*)sourceThread connection: (XMPPConnection*)connection; @end @implementation XMPPConnection_ConnectThread - initWithSourceThread: (OFThread*)sourceThread_ connection: (XMPPConnection*)connection_ { self = [super init]; @try { sourceThread = [sourceThread_ retain]; connection = [connection_ retain]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [sourceThread release]; [connection release]; [super dealloc]; } - (void)didConnect { [self join]; [connection handleConnection]; } - (id)main { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; [connection connect]; [self performSelector: @selector(didConnect) onThread: sourceThread waitUntilDone: NO]; [pool release]; return nil; } @end @implementation XMPPConnection + connection { return [[[self alloc] init] autorelease]; } |
︙ | |||
303 304 305 306 307 308 309 310 311 312 313 314 315 316 | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | + + + + + + + + + + + | [sock asyncReadIntoBuffer: buffer length: BUFFER_LENGTH target: self selector: @selector(stream:didReadIntoBuffer:length: exception:)]; } - (void)asyncConnectAndHandle { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; [[[[XMPPConnection_ConnectThread alloc] initWithSourceThread: [OFThread currentThread] connection: self] autorelease] start]; [pool release]; } - (BOOL)XMPP_parseBuffer: (const void*)buffer length: (size_t)length { if ([sock isAtEndOfStream]) { [delegates broadcastSelector: @selector(connectionWasClosed:) withObject: self]; |
︙ |
Modified tests/test.m from [7aaba010fc] to [274beaa27a].
︙ | |||
113 114 115 116 117 118 119 | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - - + - - - - | } [conn setDomain: [arguments objectAtIndex: 0]]; [conn setUsername: [arguments objectAtIndex: 1]]; [conn setPassword: [arguments objectAtIndex: 2]]; [conn setResource: @"ObjXMPP"]; |
︙ |