Skip to content

Commit

Permalink
Simplified version of IPv6 changes, this is investigational and a WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
gcasa committed Nov 29, 2023
1 parent 2473c74 commit 7e975b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Source/GSSocketStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions Source/win32/NSStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7e975b0

Please sign in to comment.