diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-09-28 20:07:06 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-09-28 20:07:06 +0000 |
commit | 52717910a62fcbc9bbd34e4be76052b15ce92f26 (patch) | |
tree | b303a7b99b77e1e033db38b9980e9948106055c9 | |
parent | ee85718c80b14c3f496eb068055b6e98c53a415f (diff) | |
download | ATCD-52717910a62fcbc9bbd34e4be76052b15ce92f26.tar.gz |
ChangeLogTag:Tue Sep 28 14:48:26 1999 Irfan Pyarali <irfan@cs.wustl.edu>
-rw-r--r-- | ChangeLog-99b | 15 | ||||
-rw-r--r-- | ace/WFMO_Reactor.cpp | 108 | ||||
-rw-r--r-- | ace/WFMO_Reactor.h | 17 | ||||
-rw-r--r-- | ace/WFMO_Reactor.i | 9 |
4 files changed, 136 insertions, 13 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b index 0a5599ffe1a..90c5651ac0b 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -1,6 +1,11 @@ +Tue Sep 28 14:48:26 1999 Irfan Pyarali <irfan@cs.wustl.edu> + + * ace/WFMO_Reactor.cpp (handler): Implemented previously + unimplemented function. + Tue Sep 28 15:02:33 1999 Vishal Kachroo <vishal@cs.wustl.edu> - * ace/OS.i (ioctl): Added the #if def ACE_HAS_WINSOCK2_GQOS for + * ace/OS.i (ioctl): Added the #if def ACE_HAS_WINSOCK2_GQOS for the extra fields in struct _flowspec. Mon Sep 27 19:16:34 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> @@ -16,7 +21,7 @@ Mon Sep 27 19:30:54 1999 Carlos O'Ryan <coryan@cs.wustl.edu> Mon Sep 27 17:12:51 1999 Vishal Kachroo <vishal@cs.wustl.edu> - * ace/OS.i: + * ace/OS.i: * ace/OS.h: Added an overloaded ioctl () that is used when the io control code is one of SIO_SET_QOS or SIO_GET_QOS. Thanks to Vidya @@ -27,7 +32,7 @@ Mon Sep 27 17:12:51 1999 Vishal Kachroo <vishal@cs.wustl.edu> * ACE_wrappers/examples/QOS/client.cpp: Made changes to the usage of ioctl () in the above files to reflect the corresponding changes in ACE. - + Mon Sep 27 13:11:02 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> * ace/config-sunos5.5.h: Wrap the define statement in a @@ -86,13 +91,13 @@ Fri Sep 24 17:20:41 1999 Nanbor Wang <nanbor@cs.wustl.edu> Fri Sep 24 08:59:13 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> - * ace/config-sunos4-g++.h: Added ACE_HAS_DIRENT. + * ace/config-sunos4-g++.h: Added ACE_HAS_DIRENT. Thanks to Kamen Penev <penev@earthlink.net> for reporting this. * tests/Handle_Set_Test.cpp (test_boundaries): Added some casts and parens so that the code will compile with MSVC++ 5.0. Thanks to Carlos O'Ryan for reporting this. - + * examples/Connection/blocking/SPIPE-{acceptor,connector}.cpp: Reformatted some of the code. diff --git a/ace/WFMO_Reactor.cpp b/ace/WFMO_Reactor.cpp index 6349fb8dc6d..7eb68215aa0 100644 --- a/ace/WFMO_Reactor.cpp +++ b/ace/WFMO_Reactor.cpp @@ -1392,6 +1392,114 @@ ACE_WFMO_Reactor_Handler_Repository::modify_network_events_i (ACE_HANDLE io_hand return found; } +int +ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle, + ACE_Reactor_Mask user_masks, + ACE_Event_Handler **user_event_handler) +{ + int found = 0; + size_t i = 0; + ACE_Event_Handler *event_handler = 0; + long existing_masks; + + // + // Look for the handle first + // + + // First go through the current entries + // + // Look for all entries in the current handles for matching handle + // (except those that have been scheduled for deletion) + for (i = 0; i < this->max_handlep1_ && !found; i++) + if ((handle == this->current_info_[i].io_handle_ || + handle == this->current_handles_[i]) && + !this->current_info_[i].delete_entry_) + { + found = 1; + event_handler = this->current_info_[i].event_handler_; + existing_masks = this->current_info_[i].network_events_; + } + + // Then pass through the suspended handles + // + // Look for all entries in the suspended handles for matching handle + // (except those that have been scheduled for deletion) + for (i = 0; i < this->suspended_handles_ && !found; i++) + if ((handle == this->current_suspended_info_[i].io_handle_ || + handle == this->current_suspended_info_[i].event_handle_) && + !this->current_suspended_info_[i].delete_entry_) + { + found = 1; + event_handler = this->current_suspended_info_[i].event_handler_; + existing_masks = this->current_suspended_info_[i].network_events_; + } + + // Then check the to_be_added handles + // + // Look for all entries in the to_be_added handles for matching + // handle (except those that have been scheduled for deletion) + for (i = 0; i < this->handles_to_be_added_ && !found; i++) + if ((handle == this->to_be_added_info_[i].io_handle_ || + handle == this->to_be_added_info_[i].event_handle_) && + !this->to_be_added_info_[i].delete_entry_) + { + found = 1; + event_handler = this->to_be_added_info_[i].event_handler_; + existing_masks = this->to_be_added_info_[i].network_events_; + } + + // If the handle is not found, return failure. + if (!found) + return -1; + + // Otherwise, make sure that the masks that the user is looking for + // are on. + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::READ_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_READ) + && !ACE_BIT_ENABLED (existing_masks, FD_CLOSE)) + found = 0; + + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::WRITE_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_WRITE)) + found = 0; + + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::EXCEPT_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_OOB)) + found = 0; + + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::ACCEPT_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_ACCEPT)) + found = 0; + + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::CONNECT_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_CONNECT)) + found = 0; + + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::QOS_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_QOS)) + found = 0; + + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::GROUP_QOS_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_GROUP_QOS)) + found = 0; + + if (found && + user_event_handler) + *user_event_handler = event_handler; + + if (found) + return 0; + else + return -1; +} + // Waits for and dispatches all events. Returns -1 on error, 0 if // max_wait_time expired, or the number of events that were dispatched. int diff --git a/ace/WFMO_Reactor.h b/ace/WFMO_Reactor.h index 6104a171d75..0e720ab9f5e 100644 --- a/ace/WFMO_Reactor.h +++ b/ace/WFMO_Reactor.h @@ -93,7 +93,7 @@ public: ACE_Reactor_Mask close_masks_; // These are the masks related to <handle_close> for the - // <Event_Handler>. This is only valid when >delete_entry_> is + // <Event_Handler>. This is only valid when <delete_entry_> is // set. Common_Info (void); @@ -346,6 +346,13 @@ public: ACE_Reactor_Mask to_be_removed_masks); // Removes the <ACE_Event_Handler> at <slot> from the table. + int handler (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Event_Handler **event_handler = 0); + // Check to see if <handle> is associated with a valid Event_Handler + // bound to <mask>. Return the <event_handler> associated with this + // <handler> if <event_handler> != 0. + void dump (void) const; // Dump the state of an object. @@ -780,7 +787,7 @@ public: // with accidentally deleting the wrong timer. Returns -1 on // failure (which is guaranteed never to be a valid <timer_id>. - virtual int reset_timer_interval (long timer_id, + virtual int reset_timer_interval (long timer_id, const ACE_Time_Value &interval); // Resets the interval of the timer represented by <timer_id> to // <interval>, which is specified in relative time to the current @@ -865,7 +872,9 @@ public: virtual int handler (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Event_Handler **event_handler = 0); - // Not implemented. + // Check to see if <handle> is associated with a valid Event_Handler + // bound to <mask>. Return the <event_handler> associated with this + // <handler> if <event_handler> != 0. virtual int handler (int signum, ACE_Event_Handler ** = 0); @@ -898,7 +907,7 @@ public: virtual int restart (void); // Get the existing restart value. - + virtual int restart (int r); // Set a new value for restart and return the original value. diff --git a/ace/WFMO_Reactor.i b/ace/WFMO_Reactor.i index b60d7f48bd4..c20100446c8 100644 --- a/ace/WFMO_Reactor.i +++ b/ace/WFMO_Reactor.i @@ -433,7 +433,7 @@ ACE_WFMO_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, ACE_INLINE int ACE_WFMO_Reactor::reset_timer_interval - (long timer_id, + (long timer_id, const ACE_Time_Value &interval) { ACE_TRACE ("ACE_WFMO_Reactor::reset_timer_interval"); @@ -457,7 +457,7 @@ ACE_WFMO_Reactor::schedule_timer (ACE_Event_Handler *handler, ACE_TRACE ("ACE_WFMO_Reactor::schedule_timer"); long result = this->timer_queue_->schedule - (handler, + (handler, arg, timer_queue_->gettimeofday () + delta_time, interval); @@ -1082,8 +1082,9 @@ ACE_WFMO_Reactor::handler (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Event_Handler **event_handler) { - // Don't have an implementation for this yet... - ACE_NOTSUP_RETURN (-1); + return this->handler_rep_.handler (handle, + mask, + event_handler); } ACE_INLINE int |