295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
- (void)handleConnection
{
char *buffer = [self allocMemoryWithSize: BUFFER_LENGTH];
[sock asyncReadIntoBuffer: buffer
length: BUFFER_LENGTH
target: self
selector: @selector(stream:didReadIntoBuffer:length:)];
}
- (BOOL)XMPP_parseBuffer: (const void*)buffer
length: (size_t)length
{
if ([sock isAtEndOfStream]) {
[delegates broadcastSelector: @selector(connectionWasClosed:)
|
|
>
|
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
- (void)handleConnection
{
char *buffer = [self allocMemoryWithSize: BUFFER_LENGTH];
[sock asyncReadIntoBuffer: buffer
length: BUFFER_LENGTH
target: self
selector: @selector(stream:didReadIntoBuffer:length:
exception:)];
}
- (BOOL)XMPP_parseBuffer: (const void*)buffer
length: (size_t)length
{
if ([sock isAtEndOfStream]) {
[delegates broadcastSelector: @selector(connectionWasClosed:)
|
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
|
oldParser = nil;
oldElementBuilder = nil;
}
- (BOOL)stream: (OFStream*)stream
didReadIntoBuffer: (char*)buffer
length: (size_t)length
{
if (![self XMPP_parseBuffer: buffer
length: length])
return NO;
if (oldParser != nil || oldElementBuilder != nil) {
[oldParser release];
[oldElementBuilder release];
oldParser = nil;
oldElementBuilder = nil;
[sock asyncReadIntoBuffer: buffer
length: BUFFER_LENGTH
target: self
selector: @selector(stream:
didReadIntoBuffer:length:)];
return NO;
}
return YES;
}
|
>
>
>
>
>
>
|
|
|
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
|
oldParser = nil;
oldElementBuilder = nil;
}
- (BOOL)stream: (OFStream*)stream
didReadIntoBuffer: (char*)buffer
length: (size_t)length
exception: (OFException*)exception
{
if (exception != nil) {
[self close];
return NO;
}
if (![self XMPP_parseBuffer: buffer
length: length])
return NO;
if (oldParser != nil || oldElementBuilder != nil) {
[oldParser release];
[oldElementBuilder release];
oldParser = nil;
oldElementBuilder = nil;
[sock asyncReadIntoBuffer: buffer
length: BUFFER_LENGTH
target: self
selector: @selector(stream:didReadIntoBuffer:
length:exception:)];
return NO;
}
return YES;
}
|