summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormcorino <mcorino@users.noreply.github.com>2010-06-28 12:54:45 +0000
committermcorino <mcorino@users.noreply.github.com>2010-06-28 12:54:45 +0000
commitfa079f6c462ffb64255dc0d55973b6d3bdb4648d (patch)
tree6a8bf59022a75f958e3f2039f405a99d633fc0ce
parent6cd4fc17b5b745a45b8a212d90aa6ff293e1e8bf (diff)
downloadATCD-fa079f6c462ffb64255dc0d55973b6d3bdb4648d.tar.gz
Mon Jun 28 12:53:30 UTC 2010 Martin Corino <mcorino@remedy.nl>
* protocols/ace/INet/StreamHandler.h: * protocols/ace/INet/StreamHandler.cpp: Fixed problem with reactive write.
-rw-r--r--ACE/ChangeLog10
-rw-r--r--ACE/protocols/ace/INet/StreamHandler.cpp32
-rw-r--r--ACE/protocols/ace/INet/StreamHandler.h19
3 files changed, 47 insertions, 14 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index a96115c29ba..036fd7e7440 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,9 @@
+Mon Jun 28 12:53:30 UTC 2010 Martin Corino <mcorino@remedy.nl>
+
+ * protocols/ace/INet/StreamHandler.h:
+ * protocols/ace/INet/StreamHandler.cpp:
+ Fixed problem with reactive write.
+
Mon Jun 28 12:19:05 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
* html/Stats/index.shtml:
@@ -6,10 +12,10 @@ Mon Jun 28 12:19:05 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
Mon Jun 28 11:32:30 UTC 2010 Martin Corino <mcorino@remedy.nl>
* protocols/ace/INet/FTP_Response.h:
- Added missing include.
+ Added missing include.
* protocols/ace/INet/FTP_Session.cpp:
- Fixed truncate warning.
+ Fixed truncate warning.
Mon Jun 28 10:37:30 UTC 2010 Martin Corino <mcorino@remedy.nl>
diff --git a/ACE/protocols/ace/INet/StreamHandler.cpp b/ACE/protocols/ace/INet/StreamHandler.cpp
index b31691e3e5e..c779692f384 100644
--- a/ACE/protocols/ace/INet/StreamHandler.cpp
+++ b/ACE/protocols/ace/INet/StreamHandler.cpp
@@ -25,7 +25,10 @@ namespace ACE
: ACE_Svc_Handler<ACE_PEER_STREAM, ACE_SYNCH_USE> (thr_mgr, mq, reactor),
connected_ (false),
send_timeout_ (false),
- receive_timeout_ (false)
+ receive_timeout_ (false),
+ notification_strategy_ (reactor,
+ this,
+ ACE_Event_Handler::WRITE_MASK)
{
INET_TRACE ("ACE_IOS_StreamHandler - ctor");
@@ -432,6 +435,21 @@ namespace ACE
{
INET_TRACE ("ACE_IOS_StreamHandler::write_to_stream");
+ // check if we're allowed to control the reactor if reactive
+ bool use_reactor = this->using_reactor ();
+ if (use_reactor)
+ {
+ ACE_thread_t tid;
+ this->reactor ()->owner (&tid);
+ use_reactor =
+ ACE_OS::thr_equal (ACE_Thread::self (), tid) ? true : false;
+ }
+
+ // set notification strategy if reactive
+ NotificationStrategyGuard ns_guard__(*this,
+ use_reactor ?
+ &this->notification_strategy_ : 0);
+
size_t datasz = length * char_size;
ACE_Message_Block *mb = 0;
ACE_NEW_RETURN (mb, ACE_Message_Block (datasz), -1);
@@ -450,17 +468,7 @@ namespace ACE
ACE_Time_Value max_wait_time = this->sync_opt_.timeout ();
int result = 0;
- // check if we're allowed to control the reactor if reactive
- bool reactor_thread = false;
- if (this->using_reactor ())
- {
- ACE_thread_t tid;
- this->reactor ()->owner (&tid);
- reactor_thread =
- ACE_OS::thr_equal (ACE_Thread::self (), tid) ? true : false;
- }
-
- if (this->using_reactor () && reactor_thread)
+ if (use_reactor)
{
if (this->reactor ()->register_handler(this,
ACE_Event_Handler::WRITE_MASK) != 0)
diff --git a/ACE/protocols/ace/INet/StreamHandler.h b/ACE/protocols/ace/INet/StreamHandler.h
index a8761cf2e5f..537821c3b57 100644
--- a/ACE/protocols/ace/INet/StreamHandler.h
+++ b/ACE/protocols/ace/INet/StreamHandler.h
@@ -18,6 +18,7 @@
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Svc_Handler.h"
+#include "ace/Reactor_Notification_Strategy.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -112,6 +113,24 @@ namespace ACE
ACE_Synch_Options sync_opt_;
bool send_timeout_;
bool receive_timeout_;
+ ACE_Reactor_Notification_Strategy notification_strategy_;
+
+ class NotificationStrategyGuard
+ {
+ public:
+ NotificationStrategyGuard (this_type& queue_owner,
+ ACE_Reactor_Notification_Strategy* ns)
+ : queue_owner_ (queue_owner)
+ {
+ this->queue_owner_.msg_queue ()->notification_strategy (ns);
+ }
+ ~NotificationStrategyGuard ()
+ {
+ this->queue_owner_.msg_queue ()->notification_strategy (0);
+ }
+ private:
+ this_type& queue_owner_;
+ };
};
typedef StreamHandler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> SockStreamHandler;