{"action":"created","issue":{"url":"https://api.github.com/repos/bel2125/civetweb/issues/184","labels_url":"https://api.github.com/repos/bel2125/civetweb/issues/184/labels{/name}","comments_url":"https://api.github.com/repos/bel2125/civetweb/issues/184/comments","events_url":"https://api.github.com/repos/bel2125/civetweb/issues/184/events","html_url":"https://github.com/bel2125/civetweb/issues/184","id":98501387,"number":184,"title":"Timeout of push() down to SOCKET_TIMEOUT_QUANTUM","user":{"login":"xtne6f","id":2673799,"avatar_url":"https://avatars.githubusercontent.com/u/2673799?v=3","gravatar_id":"","url":"https://api.github.com/users/xtne6f","html_url":"https://github.com/xtne6f","followers_url":"https://api.github.com/users/xtne6f/followers","following_url":"https://api.github.com/users/xtne6f/following{/other_user}","gists_url":"https://api.github.com/users/xtne6f/gists{/gist_id}","starred_url":"https://api.github.com/users/xtne6f/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xtne6f/subscriptions","organizations_url":"https://api.github.com/users/xtne6f/orgs","repos_url":"https://api.github.com/users/xtne6f/repos","events_url":"https://api.github.com/users/xtne6f/events{/privacy}","received_events_url":"https://api.github.com/users/xtne6f/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-01T02:58:10Z","updated_at":"2015-08-01T12:41:23Z","closed_at":"2015-08-01T12:41:23Z","body":"Because its `do...while` loop never repeats. Redefine SOCKET_TIMEOUT_QUANTUM as (100)～(1000), then you can easily confirm this problem.\r\nSSL-enabled pull() would also have the same problem, because SSL_read/SSL_write does not return its error by ERRNO.\r\nI think it might be impossible to interrupt and resume blocking send()/recv() by SOCKET_TIMEOUT_QUANTUM, see SO_SNDTIMEO/SO_RCVTIMEO of https://msdn.microsoft.com/en-us/library/windows/desktop/ms740532 .\r\n"},"comment":{"url":"https://api.github.com/repos/bel2125/civetweb/issues/comments/126911153","html_url":"https://github.com/bel2125/civetweb/issues/184#issuecomment-126911153","issue_url":"https://api.github.com/repos/bel2125/civetweb/issues/184","id":126911153,"user":{"login":"xtne6f","id":2673799,"avatar_url":"https://avatars.githubusercontent.com/u/2673799?v=3","gravatar_id":"","url":"https://api.github.com/users/xtne6f","html_url":"https://github.com/xtne6f","followers_url":"https://api.github.com/users/xtne6f/followers","following_url":"https://api.github.com/users/xtne6f/following{/other_user}","gists_url":"https://api.github.com/users/xtne6f/gists{/gist_id}","starred_url":"https://api.github.com/users/xtne6f/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xtne6f/subscriptions","organizations_url":"https://api.github.com/users/xtne6f/orgs","repos_url":"https://api.github.com/users/xtne6f/repos","events_url":"https://api.github.com/users/xtne6f/events{/privacy}","received_events_url":"https://api.github.com/users/xtne6f/received_events","type":"User","site_admin":false},"created_at":"2015-08-01T12:41:23Z","updated_at":"2015-08-01T12:41:23Z","body":"Thank you for your reply.\r\n\r\nOpenSSL says:\r\n> a call to SSL_read() can also cause write operations!\r\n\r\nI don't know whether OpenSSL preserves the socket error and always calls recv() after send(),\r\nthough, the result of SSL_read() can be got by SSL_get_error() officially, so I think there is no need to use such an unreliable way.\r\n\r\n> I think that you should not continue using a socket that once timed out might be outdated:\r\n\r\nrecv() would be OK, inner TCP receiving procedure can be paused at any time. Though the description only refers to recv(). MSDN says:\r\n> If a send or receive operation times out on a socket, the socket state is indeterminate,\r\n> and should not be used; TCP sockets in this state have a potential for data loss,\r\n> since the operation could be canceled at the same moment the operation was to be completed.\r\n\r\nIf this description is true, we'll be unable to avoid the possibility of duplicated sending of buffer.\r\nAnyway, I had better to investigate it, and propose an alternative method by myself.\r\nI'll close this issue for now."}}