mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
fix for delay in tls write
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37397 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8c09d03d19
commit
299469bbf0
3 changed files with 58 additions and 9 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2013-11-222 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/GSTLS.m:
|
||||||
|
Set errno to EAGAIN if TLS layer fails in a non-fatal way during
|
||||||
|
read/write.
|
||||||
|
Add more/better debug logging.
|
||||||
|
|
||||||
2013-11-20 Richard Frith-Macdonald <rfm@gnu.org>
|
2013-11-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSUserDefaults.m: Fix for bug 40620
|
* Source/NSUserDefaults.m: Fix for bug 40620
|
||||||
|
|
|
@ -2047,7 +2047,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
||||||
int written;
|
int written;
|
||||||
|
|
||||||
written = [self write: (char*)ptr+writePos
|
written = [self write: (char*)ptr+writePos
|
||||||
length: length-writePos];
|
length: length-writePos];
|
||||||
if (written <= 0)
|
if (written <= 0)
|
||||||
{
|
{
|
||||||
if (written < 0 && errno != EAGAIN && errno != EINTR)
|
if (written < 0 && errno != EAGAIN && errno != EINTR)
|
||||||
|
|
|
@ -1611,14 +1611,13 @@ static NSMutableDictionary *credentialsCache = nil;
|
||||||
{
|
{
|
||||||
NSString *p;
|
NSString *p;
|
||||||
|
|
||||||
if (GNUTLS_E_WARNING_ALERT_RECEIVED == result)
|
if (GNUTLS_E_AGAIN == result)
|
||||||
{
|
{
|
||||||
if (YES == debug)
|
errno = EAGAIN; // Need to retry.
|
||||||
{
|
}
|
||||||
p = [NSString stringWithFormat: @"%s",
|
else if (GNUTLS_E_INTERRUPTED == result)
|
||||||
gnutls_alert_get_name(gnutls_alert_get(session))];
|
{
|
||||||
NSLog(@"%@ %@", self, p);
|
errno = EINTR; // Need to retry
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (gnutls_error_is_fatal(result))
|
else if (gnutls_error_is_fatal(result))
|
||||||
{
|
{
|
||||||
|
@ -1629,13 +1628,56 @@ static NSMutableDictionary *credentialsCache = nil;
|
||||||
NSLog(@"%@ %@", self, p);
|
NSLog(@"%@ %@", self, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (GNUTLS_E_WARNING_ALERT_RECEIVED == result)
|
||||||
|
{
|
||||||
|
if (YES == debug)
|
||||||
|
{
|
||||||
|
p = [NSString stringWithFormat: @"%s",
|
||||||
|
gnutls_alert_get_name(gnutls_alert_get(session))];
|
||||||
|
NSLog(@"%@ %@", self, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errno = EAGAIN; // Need to retry.
|
||||||
|
}
|
||||||
|
result = -1;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger) write: (const void*)buf length: (NSUInteger)len
|
- (NSInteger) write: (const void*)buf length: (NSUInteger)len
|
||||||
{
|
{
|
||||||
return gnutls_record_send(session, buf, len);
|
int result = gnutls_record_send(session, buf, len);
|
||||||
|
|
||||||
|
if (result < 0)
|
||||||
|
{
|
||||||
|
if (GNUTLS_E_AGAIN == result)
|
||||||
|
{
|
||||||
|
errno = EAGAIN; // Need to retry.
|
||||||
|
}
|
||||||
|
else if (GNUTLS_E_INTERRUPTED == result)
|
||||||
|
{
|
||||||
|
errno = EINTR; // Need to retry
|
||||||
|
}
|
||||||
|
else if (gnutls_error_is_fatal(result))
|
||||||
|
{
|
||||||
|
NSString *p;
|
||||||
|
|
||||||
|
p = [NSString stringWithFormat: @"%s", gnutls_strerror(result)];
|
||||||
|
ASSIGN(problem, p);
|
||||||
|
if (YES == debug)
|
||||||
|
{
|
||||||
|
NSLog(@"%@ %@", self, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errno = EAGAIN; // Need to retry.
|
||||||
|
}
|
||||||
|
result = -1;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copied/based on the public domain code provided by gnutls
|
/* Copied/based on the public domain code provided by gnutls
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue