mirror of
https://github.com/nmap/nmap.git
synced 2026-01-05 14:09:02 +00:00
Nsock iocp: pass immediate errors on to process_event()
This commit is contained in:
@@ -418,15 +418,16 @@ void iterate_through_event_lists(struct npool *nsp) {
|
||||
free_eov(nsp, iinfo->eov);
|
||||
gh_list_prepend(&nsp->free_iods, &nsi->nodeq);
|
||||
iinfo->eov = NULL;
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Here are more things that should be true */
|
||||
assert(iinfo->eov->nse_id == nse->id);
|
||||
assert(iinfo->eov == nse->eov);
|
||||
|
||||
if (!HasOverlappedIoCompleted((OVERLAPPED*)iinfo->eov))
|
||||
if (!iinfo->eov->err && !HasOverlappedIoCompleted((OVERLAPPED*)iinfo->eov)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
gh_list_t *evlist = NULL;
|
||||
int ev = 0;
|
||||
@@ -451,7 +452,7 @@ void iterate_through_event_lists(struct npool *nsp) {
|
||||
if (nse->type == NSE_TYPE_CONNECT || nse->type == NSE_TYPE_CONNECT_SSL) {
|
||||
setsockopt(nse->iod->sd, SOL_SOCKET, SO_UPDATE_CONNECT_CONTEXT, NULL, 0);
|
||||
DWORD dwRes;
|
||||
if (!GetOverlappedResult((HANDLE)nse->iod->sd, (LPOVERLAPPED)iinfo->eov, &dwRes, FALSE)) {
|
||||
if (!GetOverlappedResult((HANDLE)nse->iod->sd, (LPOVERLAPPED)iinfo->eov, &dwRes, FALSE)) {
|
||||
int err = map_faulty_errors(socket_errno());
|
||||
if (err)
|
||||
setsockopt(nse->iod->sd, SOL_SOCKET, SO_ERROR, (char *)&err, sizeof(err));
|
||||
@@ -500,7 +501,7 @@ static struct extended_overlapped *new_eov(struct npool *nsp, struct nevent *nse
|
||||
|
||||
assert(nse);
|
||||
assert(!nse->eov);
|
||||
lnode = gh_list_pop(&iinfo->free_eovs);
|
||||
lnode = gh_list_pop(&iinfo->free_eovs);
|
||||
if (!lnode)
|
||||
eov = (struct extended_overlapped *)safe_malloc(sizeof(struct extended_overlapped));
|
||||
else
|
||||
@@ -572,8 +573,8 @@ static void call_connect_overlapped(struct npool *nsp, struct nevent *nse) {
|
||||
if (ret)
|
||||
fatal("Error initiating event type(%d)", nse->type);
|
||||
|
||||
ret = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&one, sizeof(one));
|
||||
if (ret == -1) {
|
||||
ret = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&one, sizeof(one));
|
||||
if (ret == -1) {
|
||||
int err = socket_errno();
|
||||
nse->event_done = 1;
|
||||
nse->status = NSE_STATUS_ERROR;
|
||||
|
||||
Reference in New Issue
Block a user