Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in Windows platform couldn't check remote was closed #202

Closed
darklost opened this issue Jan 7, 2017 · 2 comments
Closed

in Windows platform couldn't check remote was closed #202

darklost opened this issue Jan 7, 2017 · 2 comments

Comments

@darklost
Copy link

darklost commented Jan 7, 2017

/* On UDP, a connreset simply means the previous send failed.
* So we try again.
* On TCP, it means our socket is now useless, so the error passes.
* (We will loop again, exiting because the same error will happen) */

as this in wsocket.c line 256 try again but may it missing continue ? prev still IO_DONE
in if (err != WSAECONNRESET || prev == WSAECONNRESET) return err;

int socket_recv(p_socket ps, char *data, size_t count, size_t *got, 
        p_timeout tm) 
{
    int err, prev = IO_DONE;
    *got = 0;
    if (*ps == SOCKET_INVALID) return IO_CLOSED;
    for ( ;; ) {
        int taken = recv(*ps, data, (int) count, 0);
        if (taken > 0) {
            *got = taken;
            return IO_DONE;
        }
        if (taken == 0) return IO_CLOSED;
        err = WSAGetLastError();
        /* On UDP, a connreset simply means the previous send failed. 
         * So we try again. 
         * On TCP, it means our socket is now useless, so the error passes. 
         * (We will loop again, exiting because the same error will happen) */
        if (err != WSAEWOULDBLOCK) {
                        if (err != WSAECONNRESET || prev == WSAECONNRESET) return err;
                        prev = err;
			//change by  2017-1-7 01:59:38 darklost.me
			//settimeout(0) is always return IO_TIMEOUT when remote server is closed!
			//maybe missing continue here?
			continue;
        }
        if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err;
    }
}

in function int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got, SA *addr, socklen_t *len, p_timeout tm) the same as above

may be missing continue ?

@alerque
Copy link
Member

alerque commented Nov 10, 2023

Is it possible that this just recently got fixed with the merger of #81? Can you confirm this with the scm version?

@alerque
Copy link
Member

alerque commented Nov 10, 2023

Pretty sure this is a duplicate of #174, and the comment about possibly being fixed still applies. In any case lets track it in one issue.

@alerque alerque closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants