From 7e975b0d9d85b88c4325fcbb759a07686b7870d0 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Wed, 29 Nov 2023 13:33:36 -0500 Subject: [PATCH] Simplified version of IPv6 changes, this is investigational and a WIP --- Source/GSSocketStream.m | 10 +++++----- Source/win32/NSStream.m | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Source/GSSocketStream.m b/Source/GSSocketStream.m index 323001fdab..e42968c280 100644 --- a/Source/GSSocketStream.m +++ b/Source/GSSocketStream.m @@ -1849,7 +1849,7 @@ - (void) open [GSTLSHandler tryInput: self output: _sibling]; } - result = connect([self _sock], &_address.s, + result = connect([self _sock], (struct sockaddr *)&_address.s, GSPrivateSockaddrLength(&_address.s)); if (socketError(result)) { @@ -2370,7 +2370,7 @@ - (void) open [GSTLSHandler tryInput: _sibling output: self]; } - result = connect([self _sock], &_address.s, + result = connect([self _sock], (struct sockaddr *)&_address.s, GSPrivateSockaddrLength(&_address.s)); if (socketError(result)) { @@ -2792,7 +2792,7 @@ - (void) open #endif bindReturn = bind([self _sock], - &_address.s, GSPrivateSockaddrLength(&_address.s)); + (struct sockaddr *)&_address.s, GSPrivateSockaddrLength(&_address.s)); if (socketError(bindReturn)) { [self _recordError]; @@ -2854,11 +2854,11 @@ - (void) acceptWithInputStream: (NSInputStream **)inputStream struct { uint8_t bytes[BUFSIZ]; } __attribute__((aligned(2)))buf; - struct sockaddr *addr = (struct sockaddr*)&buf; + struct sockaddr_storate *addr = (struct sockaddr_storage *)&buf; socklen_t len = sizeof(buf); int acceptReturn; - acceptReturn = accept([self _sock], addr, (OPTLEN*)&len); + acceptReturn = accept([self _sock], (struct sockaddr *)addr, (OPTLEN*)&len); _events &= ~NSStreamEventHasBytesAvailable; if (socketError(acceptReturn)) { // test for real error diff --git a/Source/win32/NSStream.m b/Source/win32/NSStream.m index b66e78deed..1630d3ade3 100644 --- a/Source/win32/NSStream.m +++ b/Source/win32/NSStream.m @@ -961,6 +961,14 @@ + (void) getStreamsToHost: (NSHost *)host #endif } + if (!ins) + { +#if defined(AF_INET6) + ins = (GSSocketStream *)AUTORELEASE([[GSInet6InputStream alloc] initToAddr: address port: port]); + outs = (GSSocketStream *)AUTORELEASE([[GSInet6OutputStream alloc] initToAddr: address port: port]); +#endif + } + /* * Windows only permits a single event to be associated with a socket * at any time, but the runloop system only allows an event handle to