|
@@ -370,14 +370,14 @@ void runOnMainQueueWithoutDeadlocking(void (^block)(void))
|
370
|
370
|
|
371
|
371
|
switch(eventCode) {
|
372
|
372
|
|
373
|
|
- // write stream event
|
|
373
|
+ // write stream event
|
374
|
374
|
case NSStreamEventHasSpaceAvailable:
|
375
|
375
|
{
|
376
|
376
|
|
377
|
377
|
|
378
|
378
|
}
|
379
|
379
|
|
380
|
|
- // read stream incoming chunk
|
|
380
|
+ // read stream incoming chunk
|
381
|
381
|
case NSStreamEventHasBytesAvailable:
|
382
|
382
|
{
|
383
|
383
|
NSMutableData * chunkData = [[NSMutableData alloc] init];
|
|
@@ -386,7 +386,6 @@ void runOnMainQueueWithoutDeadlocking(void (^block)(void))
|
386
|
386
|
chunkSize = 4095;
|
387
|
387
|
if(self.bufferSize > 0)
|
388
|
388
|
chunkSize = self.bufferSize;
|
389
|
|
-// uint8_t * buf = (uint8_t *)malloc(chunkSize);
|
390
|
389
|
uint8_t buf[chunkSize];
|
391
|
390
|
unsigned int len = 0;
|
392
|
391
|
len = [(NSInputStream *)stream read:buf maxLength:chunkSize];
|
|
@@ -420,10 +419,6 @@ void runOnMainQueueWithoutDeadlocking(void (^block)(void))
|
420
|
419
|
@"detail": asciiArray
|
421
|
420
|
}
|
422
|
421
|
];
|
423
|
|
-// free(buf);
|
424
|
|
-// asciiStr = nil;
|
425
|
|
-// buf = nil;
|
426
|
|
-// chunkData = nil;
|
427
|
422
|
return;
|
428
|
423
|
}
|
429
|
424
|
// convert byte array to base64 data chunks
|
|
@@ -449,8 +444,6 @@ void runOnMainQueueWithoutDeadlocking(void (^block)(void))
|
449
|
444
|
@"detail": encodedChunk
|
450
|
445
|
}
|
451
|
446
|
];
|
452
|
|
-// chunkData = nil;
|
453
|
|
-// free(buf);
|
454
|
447
|
}
|
455
|
448
|
// end of stream
|
456
|
449
|
else {
|
|
@@ -461,13 +454,11 @@ void runOnMainQueueWithoutDeadlocking(void (^block)(void))
|
461
|
454
|
@"detail": @""
|
462
|
455
|
}
|
463
|
456
|
];
|
464
|
|
-// chunkData = nil;
|
465
|
|
-// free(buf);
|
466
|
457
|
}
|
467
|
458
|
break;
|
468
|
459
|
}
|
469
|
460
|
|
470
|
|
- // stream error
|
|
461
|
+ // stream error
|
471
|
462
|
case NSStreamEventErrorOccurred:
|
472
|
463
|
{
|
473
|
464
|
[self.bridge.eventDispatcher
|