mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fix for occasional hang
This commit is contained in:
parent
84716e7d70
commit
78642305c6
4 changed files with 32 additions and 0 deletions
|
@ -1,3 +1,12 @@
|
|||
2022-11-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/GNUstepBase/GSTLS.h:
|
||||
* Source/GSTLS.m:
|
||||
Add -pending method to return the number of bytes in the read bufffer.
|
||||
* Source/NSSocketPort.m:
|
||||
Use the new method to avoid a potential hang on an encrypted DO
|
||||
connection.
|
||||
|
||||
2022-10-21 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSHTTPURLHandle.m: Refactor a litle to avoid code duplication
|
||||
|
|
|
@ -265,6 +265,13 @@ GS_EXPORT_CLASS
|
|||
*/
|
||||
- (NSString*) owner;
|
||||
|
||||
/** Returns the number of bytes of data available to be read from the TLS
|
||||
* buffers (using the -read:length: method). If this returns zero the TLS
|
||||
* software needs to perform a network read before any more data can be
|
||||
* returned.
|
||||
*/
|
||||
- (size_t) pending;
|
||||
|
||||
/* After a failed handshake, this should contain a description of the
|
||||
* failure reason.
|
||||
*/
|
||||
|
|
|
@ -2063,6 +2063,11 @@ retrieve_callback(gnutls_session_t session,
|
|||
return owner;
|
||||
}
|
||||
|
||||
- (size_t) pending
|
||||
{
|
||||
return gnutls_record_check_pending(session);
|
||||
}
|
||||
|
||||
- (NSString*) problem
|
||||
{
|
||||
return problem;
|
||||
|
|
|
@ -862,6 +862,9 @@ static Class runLoopClass;
|
|||
|
||||
- (void) receivedEventRead
|
||||
{
|
||||
#if defined(HAVE_GNUTLS)
|
||||
do {
|
||||
#endif
|
||||
unsigned want;
|
||||
void *bytes;
|
||||
int res;
|
||||
|
@ -1219,6 +1222,14 @@ static Class runLoopClass;
|
|||
bytes = [rData mutableBytes];
|
||||
}
|
||||
}
|
||||
#if defined(HAVE_GNUTLS)
|
||||
/* As long as there are bytes available in the TLS buffers we must act as
|
||||
* if the network connection is readable, otherwise we could have a hang
|
||||
* waiting for the run loop to signal more data when the TLS layer has
|
||||
* already read it.
|
||||
*/
|
||||
} while ([session pending]);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) receivedEventWrite
|
||||
|
|
Loading…
Reference in a new issue