Skip to content

Commit

Permalink
remove PARROT_NET_DEVEL-
Browse files Browse the repository at this point in the history
 Resolve TT parrot#534



git-svn-id: https://svn.parrot.org/parrot/trunk@47583 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
coke committed Jun 13, 2010
1 parent 3128f37 commit 7724670
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 46 deletions.
4 changes: 1 addition & 3 deletions examples/io/http.pir
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ examples/io/http.pir - HTTP client

HTTP client, connects to WWW port and grabs a page (L<http://www.ibm.com>).

You should be running the echo service on your box (port 7). Be sure to
set C<PARROT_NET_DEVEL> to 1 in F<io/io_private.h> and rebuld Parrot or
the network layer won't exist.
You should be running the echo service on your box (port 7).

=cut

Expand Down
1 change: 0 additions & 1 deletion examples/io/httpd.pir
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ SERVE_404:

ERR_NO_SOCKET:
print "Could not open socket.\n"
print "Did you enable PARROT_NET_DEVEL in include/io_private.h?\n"
end
ERR_bind:
print "bind failed\n"
Expand Down
16 changes: 6 additions & 10 deletions src/io/io_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,19 @@ Some ideas from AT&T SFIO.

#define PARROT_IN_IO 1
#define PARROT_ASYNC_DEVEL 0
#define PARROT_NET_DEVEL 1

#include <parrot/io.h>

#if PARROT_NET_DEVEL
/* XXX: Parrot config is currently not probing for all headers so
* I'm sticking here rather than parrot.h
*/
# ifdef UNIX
# include <sys/socket.h>
# endif

# ifdef WIN32
# include <winsock.h>
# endif
#ifdef UNIX
# include <sys/socket.h>
#endif

#endif /* PARROT_NET_DEVEL */
#ifdef WIN32
# include <winsock.h>
#endif

/* IO object flags */
#define PIO_F_READ 00000001
Expand Down
23 changes: 9 additions & 14 deletions src/io/socket_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ static void get_sockaddr_in(PARROT_INTERP, ARGIN(PMC * sockaddr),
=head2 Networking
Define C<PARROT_NET_DEVEL> to enable networking.
These could be native extensions but they probably should be here if we
wish to make them integrated with the async IO system.
Expand Down Expand Up @@ -110,8 +108,6 @@ Parrot_io_sockaddr_in(PARROT_INTERP, ARGIN(STRING *addr), INTVAL port)
}


# if PARROT_NET_DEVEL

/*
=item C<INTVAL Parrot_io_socket_unix(PARROT_INTERP, PMC *s, int fam, int type,
Expand Down Expand Up @@ -314,13 +310,13 @@ Parrot_io_send_unix(SHIM_INTERP, ARGMOD(PMC *socket), ARGMOD(STRING *s))
switch (errno) {
case EINTR:
goto AGAIN;
# ifdef EWOULDBLOCK
# ifdef EWOULDBLOCK
case EWOULDBLOCK:
goto AGAIN;
# else
# else
case EAGAIN:
goto AGAIN;
# endif
# endif
case EPIPE:
/* XXX why close it here and not below */
close(io->os_handle);
Expand Down Expand Up @@ -363,13 +359,13 @@ Parrot_io_recv_unix(PARROT_INTERP, ARGMOD(PMC *socket), ARGOUT(STRING **s))
switch (errno) {
case EINTR:
goto AGAIN;
# ifdef EWOULDBLOCK
# ifdef EWOULDBLOCK
case EWOULDBLOCK:
goto AGAIN;
# else
# else
case EAGAIN:
goto AGAIN;
# endif
# endif
case ECONNRESET:
/* XXX why close it on err return result is -1 anyway */
close(io->os_handle);
Expand Down Expand Up @@ -457,12 +453,12 @@ get_sockaddr_in(PARROT_INTERP, ARGIN(PMC * sockaddr), ARGIN(const char* host),
const int family = AF_INET;

struct sockaddr_in * const sa = (struct sockaddr_in*)VTABLE_get_pointer(interp, sockaddr);
# ifdef PARROT_DEF_INET_ATON
# ifdef PARROT_DEF_INET_ATON
if (inet_aton(host, &sa->sin_addr) != 0) {
# else
# else
/* positive retval is success */
if (inet_pton(family, host, &sa->sin_addr) > 0) {
# endif
# endif
/* Success converting numeric IP */
}
else {
Expand All @@ -482,7 +478,6 @@ get_sockaddr_in(PARROT_INTERP, ARGIN(PMC * sockaddr), ARGIN(const char* host),
sa->sin_family = family;
sa->sin_port = htons(port);
}
# endif


#endif /* PIO_OS_UNIX */
Expand Down
24 changes: 10 additions & 14 deletions src/io/socket_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@ static void get_sockaddr_in(PARROT_INTERP,
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */

# if PARROT_NET_DEVEL

/* Helper macros to get sockaddr_in */
# define SOCKADDR_LOCAL(p) ((struct sockaddr_in*)VTABLE_get_pointer(interp, \
PARROT_SOCKET((p))->local))
# define SOCKADDR_REMOTE(p) ((struct sockaddr_in*)VTABLE_get_pointer(interp, \
PARROT_SOCKET((p))->remote))
# define SOCKADDR_LOCAL(p) ((struct sockaddr_in*)VTABLE_get_pointer(interp, \
PARROT_SOCKET((p))->local))
# define SOCKADDR_REMOTE(p) ((struct sockaddr_in*)VTABLE_get_pointer(interp, \
PARROT_SOCKET((p))->remote))

/*
Expand Down Expand Up @@ -262,13 +260,13 @@ Parrot_io_send_win32(SHIM_INTERP, ARGMOD(PMC *socket), ARGMOD(STRING *s))
switch (errno) {
case WSAEINTR:
goto AGAIN;
# ifdef WSAEWOULDBLOCK
# ifdef WSAEWOULDBLOCK
case WSAEWOULDBLOCK:
goto AGAIN;
# else
# else
case WSAEAGAIN:
goto AGAIN;
# endif
# endif
case EPIPE:
/* XXX why close it here and not below */
close((int)io->os_handle);
Expand Down Expand Up @@ -311,13 +309,13 @@ Parrot_io_recv_win32(PARROT_INTERP, ARGMOD(PMC *socket), ARGOUT(STRING **s))
switch (errno) {
case EINTR:
goto AGAIN;
# ifdef WSAEWOULDBLOCK
# ifdef WSAEWOULDBLOCK
case WSAEWOULDBLOCK:
goto AGAIN;
# else
# else
case WSAEAGAIN:
goto AGAIN;
# endif
# endif
case WSAECONNRESET:
/* XXX why close it on err return result is -1 anyway */
close((int)io->os_handle);
Expand Down Expand Up @@ -452,8 +450,6 @@ Parrot_io_sockaddr_in(PARROT_INTERP, ARGIN(STRING *addr), INTVAL port)
return sockaddr;
}

# endif /* PARROT_NET_DEVEL */

#endif /* PIO_OS_WIN32 */

/*
Expand Down
4 changes: 0 additions & 4 deletions src/io/win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,8 @@ Parrot_io_init_win32(PARROT_INTERP)
{
ASSERT_ARGS(Parrot_io_init_win32)
HANDLE h;
# if PARROT_NET_DEVEL
struct WSAData sockinfo;
int ret;
# endif

if ((h = GetStdHandle(STD_INPUT_HANDLE)) != INVALID_HANDLE_VALUE) {
_PIO_STDIN(interp) = Parrot_io_fdopen_win32(interp, PMCNULL, h, PIO_F_READ);
Expand All @@ -157,7 +155,6 @@ Parrot_io_init_win32(PARROT_INTERP)
else {
_PIO_STDERR(interp) = PMCNULL;
}
# if PARROT_NET_DEVEL
/* Start Winsock
* no idea where or whether destroy it
*/
Expand All @@ -167,7 +164,6 @@ Parrot_io_init_win32(PARROT_INTERP)
WSAGetLastError());
return -4;
}
# endif
return 0;
}

Expand Down

0 comments on commit 7724670

Please sign in to comment.