mirror of
https://github.com/nmap/nmap.git
synced 2025-12-19 14:09:02 +00:00
New function msevent_timedout().
This commit is contained in:
@@ -939,7 +939,7 @@ void process_event(mspool *nsp, gh_list *evlist, msevent *nse, int ev) {
|
|||||||
case NSE_TYPE_CONNECT_SSL:
|
case NSE_TYPE_CONNECT_SSL:
|
||||||
if (ev != EV_NONE)
|
if (ev != EV_NONE)
|
||||||
handle_connect_result(nsp, nse, NSE_STATUS_SUCCESS);
|
handle_connect_result(nsp, nse, NSE_STATUS_SUCCESS);
|
||||||
if (!nse->event_done && nse->timeout.tv_sec && !TIMEVAL_AFTER(nse->timeout, nsock_tod))
|
if (msevent_timedout(nse))
|
||||||
handle_connect_result(nsp, nse, NSE_STATUS_TIMEOUT);
|
handle_connect_result(nsp, nse, NSE_STATUS_TIMEOUT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -956,7 +956,7 @@ void process_event(mspool *nsp, gh_list *evlist, msevent *nse, int ev) {
|
|||||||
if (!nse->iod->ssl && match_r)
|
if (!nse->iod->ssl && match_r)
|
||||||
handle_read_result(nsp, nse, NSE_STATUS_SUCCESS);
|
handle_read_result(nsp, nse, NSE_STATUS_SUCCESS);
|
||||||
|
|
||||||
if (!nse->event_done && nse->timeout.tv_sec && !TIMEVAL_AFTER(nse->timeout, nsock_tod))
|
if (msevent_timedout(nse))
|
||||||
handle_read_result(nsp, nse, NSE_STATUS_TIMEOUT);
|
handle_read_result(nsp, nse, NSE_STATUS_TIMEOUT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -973,12 +973,12 @@ void process_event(mspool *nsp, gh_list *evlist, msevent *nse, int ev) {
|
|||||||
if (!nse->iod->ssl && match_w)
|
if (!nse->iod->ssl && match_w)
|
||||||
handle_write_result(nsp, nse, NSE_STATUS_SUCCESS);
|
handle_write_result(nsp, nse, NSE_STATUS_SUCCESS);
|
||||||
|
|
||||||
if (!nse->event_done && nse->timeout.tv_sec && !TIMEVAL_AFTER(nse->timeout, nsock_tod))
|
if (msevent_timedout(nse))
|
||||||
handle_write_result(nsp, nse, NSE_STATUS_TIMEOUT);
|
handle_write_result(nsp, nse, NSE_STATUS_TIMEOUT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSE_TYPE_TIMER:
|
case NSE_TYPE_TIMER:
|
||||||
if (nse->timeout.tv_sec && !TIMEVAL_AFTER(nse->timeout, nsock_tod))
|
if (msevent_timedout(nse))
|
||||||
handle_timer_result(nsp, nse, NSE_STATUS_SUCCESS);
|
handle_timer_result(nsp, nse, NSE_STATUS_SUCCESS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -996,7 +996,7 @@ void process_event(mspool *nsp, gh_list *evlist, msevent *nse, int ev) {
|
|||||||
if (fs_length(&(nse->iobuf)) > 0)
|
if (fs_length(&(nse->iobuf)) > 0)
|
||||||
handle_pcap_read_result(nsp, nse, NSE_STATUS_SUCCESS);
|
handle_pcap_read_result(nsp, nse, NSE_STATUS_SUCCESS);
|
||||||
|
|
||||||
if (!nse->event_done && nse->timeout.tv_sec && !TIMEVAL_AFTER(nse->timeout, nsock_tod))
|
if (msevent_timedout(nse))
|
||||||
handle_pcap_read_result(nsp, nse, NSE_STATUS_TIMEOUT);
|
handle_pcap_read_result(nsp, nse, NSE_STATUS_TIMEOUT);
|
||||||
|
|
||||||
#if PCAP_BSD_SELECT_HACK
|
#if PCAP_BSD_SELECT_HACK
|
||||||
|
|||||||
@@ -506,3 +506,9 @@ const char *nse_status2str(enum nse_status status) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int msevent_timedout(msevent *nse) {
|
||||||
|
if (nse->event_done)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return (nse->timeout.tv_sec && !TIMEVAL_AFTER(nse->timeout, nsock_tod));
|
||||||
|
}
|
||||||
|
|||||||
@@ -419,6 +419,8 @@ static inline int nsock_engine_loop(mspool *nsp, int msec_timeout) {
|
|||||||
|
|
||||||
/* ------------------- PROTOTYPES ------------------- */
|
/* ------------------- PROTOTYPES ------------------- */
|
||||||
|
|
||||||
|
int msevent_timedout(msevent *nse);
|
||||||
|
|
||||||
/* Get a new nsock_event_id, given a type */
|
/* Get a new nsock_event_id, given a type */
|
||||||
nsock_event_id get_new_event_id(mspool *nsp, enum nse_type type);
|
nsock_event_id get_new_event_id(mspool *nsp, enum nse_type type);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user