Dear Don,
        I went back to my archives....
This is the situation:
1. the code in CVS had always
int trigger[2];
2. I took the version 4.5.1 from the tar ball dated 2009-02-02 and I did the
change
SOCKET int trigger[2]; to make it work
3. then I recently took the Aolserver code from CVS Head and forgot to make
the above change and so I started to observe problems in the networking
code....
4. re-inserted the change and everything seems to work... but I will test it
and very deeply.....
5. I have to disagree with your statement
 " A Unix pipe is just a pair of file descriptors, and a file descriptor in
Unix is just an integer."
If I look at the code base (and please do the same with me)... check 
nscp/nscp.c
nsd/binder.c, fd.c, listen.c, sock.c, tclfile.c, tclhttp.c, urlopen.c
nsext/nsext.c
nspd/nspd.c
nsproxy/nsproxylib.c
nssock/nssock.c
nssl/nssl.c

Well not always "sockets" are declared/defines as SOCKET as they should be
(and this I am afraid also in Unix)

This is a problem of proper data type selection and usage, it is mostly a
consistency problem.

I would humbly suggest that one of the code maintainers takes a walk on the
code base and makes sure that everywhere we need a "socket" we have a real
SOCKET socket and not an int socket.

The code will be more consistent and more portable to Windows.

Ciao,
Maurizio

PS: the attached text file shows where the keyword SOCKET is currently
used... 


-----Original Message-----
From: AOLserver Discussion [mailto:AOLSERVER@LISTSERV.AOL.COM] On Behalf Of
Don Baccus
Sent: 04 August 2011 14:53
To: AOLSERVER@LISTSERV.AOL.COM
Subject: Re: [AOLSERVER] Aolserver Progress - Some few examples....

On Aug 4, 2011, at 12:24 AM, Maurizio Martignano wrote:


> 
>     int        trigger[2];               /* Wakeup trigger pipe. */ ß Why
is this an int when it was a SOCKET (any justification????)

A Unix pipe is just a pair of file descriptors, and a file descriptor in
Unix is just an integer.

Windows pipes are implemented differently, of course, and the semantics
aren't exactly the same, either.

Can you tell from CVS who put this code in?

I'm sure it was done from ignorance of Windows vs. Unix differences
regarding pipes, not intentionally.
>  
> I have the feeling that we are not facing Windows specific stuff, but
somehow some general errors, mistakes that happen to manifest themselves
only on Windows (64).

Not in this case, no, that's perfectly reasonable Unix code.

----
Don Baccus
http://donb.photo.net
http://birdnotes.net
http://openacs.org


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to
<lists...@listserv.aol.com> with the body of "SIGNOFF AOLSERVER" in the
email message. You can leave the Subject: field of your email blank.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to 
<lists...@listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.
 *      Socket descriptor or INVALID_SOCKET on error.
SOCKET
    SOCKET sock = INVALID_SOCKET;
./binder.c
    SOCKET sock;
static Sock *SockAccept(SOCKET lsock, Driver *drvPtr);
static int Poll(PollData *pdataPtr, SOCKET sock, int events, Ns_Time 
*timeoutPtr);
Ns_QueueWait(Ns_Conn *conn, SOCKET sock, Ns_QueueWaitProc *proc,
    SOCKET lsock;
    if (lsock != INVALID_SOCKET) {
    if (lsock != INVALID_SOCKET) {
Poll(PollData *pdataPtr, SOCKET sock, int events, Ns_Time *timeoutPtr)
SockAccept(SOCKET lsock, Driver *drvPtr)
    if (sockPtr->sock == INVALID_SOCKET) {
        setsockopt(sockPtr->sock, SOL_SOCKET, SO_SNDBUF,
        setsockopt(sockPtr->sock, SOL_SOCKET, SO_RCVBUF,
    sockPtr->sock = INVALID_SOCKET;
./driver.c
ns_sockpair(SOCKET *socks)
    SOCKET          sock;
    if (sock == INVALID_SOCKET ||
    if (socks[1] == INVALID_SOCKET ||
    if (socks[0] == INVALID_SOCKET) {
./fd.c
    SOCKET              new, sock;
        if (sock == INVALID_SOCKET) {
        if (sock == INVALID_SOCKET) {
ListenProc(SOCKET sock, void *arg, int why)
    SOCKET              new;
    if (new != INVALID_SOCKET) {
./listen.c
 *      0 or SOCKET_ERROR.
ns_socknbclose(SOCKET sock)
        return SOCKET_ERROR;
SOCKET
ns_sockdup(SOCKET sock)
        return INVALID_SOCKET;
    return (SOCKET) dup;
./nswin32.c
static SOCKET SockConnect(char *host, int port, char *lhost, int lport, int 
async);
static SOCKET SockSetup(SOCKET sock);
Ns_SockRecv(SOCKET sock, void *buf, int toread, int timeout)
Ns_SockSend(SOCKET sock, void *buf, int towrite, int timeout)
Ns_SockWait(SOCKET sock, int what, int seconds)
Ns_SockWaitEx(SOCKET sock, int what, int ms)
SOCKET
SOCKET
    SOCKET sock;
    if (sock == INVALID_SOCKET) {
    if (sock != INVALID_SOCKET && listen(sock, backlog) != 0) {
        sock = INVALID_SOCKET;
SOCKET
Ns_SockAccept(SOCKET lsock, struct sockaddr *saPtr, int *lenPtr)
    SOCKET sock;
    if (sock != INVALID_SOCKET) {
SOCKET
SOCKET
    SOCKET sock;
    if (sock != INVALID_SOCKET) {
    if (sock != INVALID_SOCKET) {
            setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof(n));
            sock = INVALID_SOCKET;
SOCKET
SOCKET
SOCKET
SOCKET
SOCKET
SOCKET
    SOCKET         sock;
    if (sock != INVALID_SOCKET) {
                && getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *) &err, &len) 
== 0
        sock = INVALID_SOCKET;
Ns_SockSetNonBlocking(SOCKET sock)
Ns_SockSetBlocking(SOCKET sock)
Ns_SockPipe(SOCKET socks[2])
static SOCKET
    SOCKET             sock;
        return INVALID_SOCKET;
    if (sock != INVALID_SOCKET) {
                sock = INVALID_SOCKET;
        if (async && sock != INVALID_SOCKET) {
CloseLater(SOCKET sock, void *arg, int why)
Ns_SockCloseLater(SOCKET sock)
static SOCKET
SockSetup(SOCKET sock)
./sock.c
    SOCKET               sock;
static int QueueSock(SOCKET sock, Ns_SockProc *proc, void *arg, int when);
static SOCKET        trigPipe[2];
Ns_SockCallback(SOCKET sock, Ns_SockProc *proc, void *arg, int when)
Ns_SockCancelCallback(SOCKET sock)
Ns_SockCancelCallbackEx(SOCKET sock, Ns_SockProc *proc, void *arg)
QueueSock(SOCKET sock, Ns_SockProc *proc, void *arg, int when)
./sockcallback.c
    SOCKET        trigger[2];     /* Trigger pipe. */
    SOCKET        sock;           /* Underlying socket. */
Ns_TaskCreate(SOCKET sock, Ns_TaskProc *proc, void *arg)
 *      The task SOCKET which the caller is responsible for closing
SOCKET
    SOCKET sock = taskPtr->sock;
./task.c
    SOCKET sock;
    SOCKET sock;
    if (sock != INVALID_SOCKET) {
HttpProc(Ns_Task *task, SOCKET sock, void *arg, int why)
./tclhttp.c
static int EnterSock(Tcl_Interp *interp, SOCKET sock);
static int EnterDup(Tcl_Interp *interp, SOCKET sock);
static int EnterDupedSocks(Tcl_Interp *interp, SOCKET sock);
    SOCKET sock;
    SOCKET      sock;
    SOCKET  sock;
    if (sock == INVALID_SOCKET) {
    SOCKET sock;
    if (sock == INVALID_SOCKET) {
    SOCKET sock;
    SOCKET sock;
    if (sock == INVALID_SOCKET) {
        if (i == INVALID_SOCKET) {
    SOCKET socks[2];
    SOCKET sock;
    SOCKET sock;
    SOCKET sock;
        if (sock > (SOCKET) *maxPtr) {
EnterSock(Tcl_Interp *interp, SOCKET sock)
EnterDup(Tcl_Interp *interp, SOCKET sock)
    if (sock == INVALID_SOCKET) {
EnterDupedSocks(Tcl_Interp *interp, SOCKET sock)
NsTclSockProc(SOCKET sock, void *arg, int why)
WaitCallback(Ns_Conn *conn, SOCKET sock, void *arg, int why)
SockListenCallback(SOCKET sock, void *arg, int why)
./tclsock.c
    SOCKET      sock;
    SOCKET          sock;
    sock = INVALID_SOCKET;
    if (sock == INVALID_SOCKET) {
        if (n == SOCKET_ERROR) {
    if (sock != INVALID_SOCKET) {
./urlopen.c


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to 
<lists...@listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to