From b68f5383b41ad85db00591510635cafa208facf2 Mon Sep 17 00:00:00 2001 From: rfm Date: Thu, 10 Jan 2008 12:25:45 +0000 Subject: [PATCH] tweak gnustls support for windows git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25918 72102866-910b-0410-8b05-ffd578937521 --- Source/GSSocketStream.m | 24 +++++++++++------------- Source/GSStream.m | 10 +++------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Source/GSSocketStream.m b/Source/GSSocketStream.m index f818a5cb1..b0f626b10 100644 --- a/Source/GSSocketStream.m +++ b/Source/GSSocketStream.m @@ -211,12 +211,7 @@ GSTLSPull(gnutls_transport_ptr_t handle, void *buffer, size_t len) } else { -#if defined(__MINGW32__) - e = WSAEWOULDBLOCK; -#else - e = EWOULDBLOCK; -#endif - + e = EAGAIN; // Tell GNUTLS this would block. } gnutls_transport_set_errno (tls->session, e); } @@ -243,11 +238,7 @@ GSTLSPush(gnutls_transport_ptr_t handle, const void *buffer, size_t len) } else { -#if defined(__MINGW32__) - e = WSAEWOULDBLOCK; -#else - e = EWOULDBLOCK; -#endif + e = EAGAIN; // Tell GNUTLS this would block. } gnutls_transport_set_errno (tls->session, e); } @@ -285,7 +276,7 @@ static gnutls_anon_client_credentials_t anoncred; /* Enable gnutls logging via NSLog */ gnutls_global_set_log_function (GSTLSLog); - //gnutls_global_set_log_level (11); + } } @@ -330,7 +321,10 @@ static gnutls_anon_client_credentials_t anoncred; { NSDebugMLLog(@"NSStream", @"Handshake status %d", ret); - // gnutls_perror(ret); + if (GSDebugSet(@"NSStream") == YES) + { + gnutls_perror(ret); + } } else { @@ -346,6 +340,10 @@ static gnutls_anon_client_credentials_t anoncred; { NSString *proto = [i propertyForKey: NSStreamSocketSecurityLevelKey]; + if (GSDebugSet(@"NSStream") == YES) + { + gnutls_global_set_log_level (11); + } if ([[o propertyForKey: NSStreamSocketSecurityLevelKey] isEqual: proto] == NO) { DESTROY(self); diff --git a/Source/GSStream.m b/Source/GSStream.m index 10fd09fe9..437ccd3a1 100644 --- a/Source/GSStream.m +++ b/Source/GSStream.m @@ -147,11 +147,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) { if (_currentStatus == NSStreamStatusNotOpen) { - NSDebugMLog(@"Attempt to close unopened stream %@", self); - } - if (_currentStatus == NSStreamStatusClosed) - { - NSDebugMLog(@"Attempt to close already closed stream %@", self); + NSDebugMLLog(@"NSStream", @"Attempt to close unopened stream %@", self); } [self _unschedule]; [self _setStatus: NSStreamStatusClosed]; @@ -203,7 +199,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) if (_currentStatus != NSStreamStatusNotOpen && _currentStatus != NSStreamStatusOpening) { - NSDebugMLog(@"Attempt to re-open stream %@", self); + NSDebugMLLog(@"NSStream", @"Attempt to re-open stream %@", self); } [self _setStatus: NSStreamStatusOpen]; [self _schedule]; @@ -392,7 +388,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) - (void) _recordError: (NSError*)anError { -// NSLog(@"%@ - %@", self, anError); + NSDebugMLLog(@"NSStream", @"record error: %@ - %@", self, anError); ASSIGN(_lastError, anError); _currentStatus = NSStreamStatusError; }