Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update GCD/GCDAsyncSocket.m #132

Merged
merged 1 commit into from

2 participants

@ercollin

Fix bugs that prevent the socket from reading any data when the following settings are used to avoid linking with SSL:
#define IS_SECURE_TRANSPORT_AVAILABLE NO
#define SECURE_TRANSPORT_MAYBE_AVAILABLE 0
#define SECURE_TRANSPORT_MAYBE_UNAVAILABLE 1

@ercollin ercollin Update GCD/GCDAsyncSocket.m
Fix bugs that prevent the socket from reading any data when the following settings are used to avoid linking with SSL:
#define IS_SECURE_TRANSPORT_AVAILABLE      NO
#define SECURE_TRANSPORT_MAYBE_AVAILABLE   0
#define SECURE_TRANSPORT_MAYBE_UNAVAILABLE 1
7eac427
@dvor dvor merged commit 7eac427 into from
@dvor
Collaborator

Thanks @ercollin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 21, 2013
  1. @ercollin

    Update GCD/GCDAsyncSocket.m

    ercollin authored
    Fix bugs that prevent the socket from reading any data when the following settings are used to avoid linking with SSL:
    #define IS_SECURE_TRANSPORT_AVAILABLE      NO
    #define SECURE_TRANSPORT_MAYBE_AVAILABLE   0
    #define SECURE_TRANSPORT_MAYBE_UNAVAILABLE 1
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 8 deletions.
  1. +8 −8 GCD/GCDAsyncSocket.m
View
16 GCD/GCDAsyncSocket.m
@@ -4244,8 +4244,8 @@ - (void)doReadData
return;
}
- BOOL hasBytesAvailable;
- unsigned long estimatedBytesAvailable;
+ BOOL hasBytesAvailable = NO;
+ unsigned long estimatedBytesAvailable = 0;
if ([self usingCFStreamForTLS])
{
@@ -4263,10 +4263,10 @@ - (void)doReadData
}
else
{
- #if SECURE_TRANSPORT_MAYBE_AVAILABLE
-
estimatedBytesAvailable = socketFDBytesAvailable;
+ #if SECURE_TRANSPORT_MAYBE_AVAILABLE
+
if (flags & kSocketSecure)
{
// There are 2 buffers to be aware of here.
@@ -4303,9 +4303,9 @@ - (void)doReadData
estimatedBytesAvailable += sslInternalBufSize;
}
- hasBytesAvailable = (estimatedBytesAvailable > 0);
-
#endif
+
+ hasBytesAvailable = (estimatedBytesAvailable > 0);
}
if ((hasBytesAvailable == NO) && ([preBuffer availableBytes] == 0))
@@ -4910,7 +4910,7 @@ - (void)doReadEOF
[self flushSSLBuffers];
}
- BOOL shouldDisconnect;
+ BOOL shouldDisconnect = NO;
NSError *error = nil;
if ((flags & kStartingReadTLS) || (flags & kStartingWriteTLS))
@@ -5037,7 +5037,7 @@ - (void)completeCurrentRead
NSAssert(currentRead, @"Trying to complete current read when there is no current read.");
- NSData *result;
+ NSData *result = nil;
if (currentRead->bufferOwner)
{
Something went wrong with that request. Please try again.