Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / Resume_Handle.cpp
blob9340184e28b6abb8e6963e75ff6f54f267d5a3e4
1 // -*- C++ -*-
2 #include "tao/Resume_Handle.h"
3 #include "tao/ORB_Core.h"
4 #include "debug.h"
6 #include "ace/Reactor.h"
8 #if !defined (__ACE_INLINE__)
9 # include "tao/Resume_Handle.inl"
10 #endif /* __ACE_INLINE__ */
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 void
15 TAO_Resume_Handle::resume_handle ()
17 // If we have a complete message, just resume the handler
18 // Resume the handler.
19 if (this->orb_core_ &&
20 this->orb_core_->reactor ()->resumable_handler () &&
21 this->flag_ == TAO_HANDLE_RESUMABLE &&
22 this->handle_ != ACE_INVALID_HANDLE)
24 if (this->orb_core_->reactor ()->resume_handler (this->handle_) == -1)
26 TAOLIB_DEBUG ((LM_DEBUG,
27 "TAO (%P|%t) - Resume_Handle::resume_handle, "
28 "resuming handler returned -1 for handle = %d\n",
29 this->handle_));
33 // Set the flag, so that we don't resume again..
34 this->flag_ = TAO_HANDLE_ALREADY_RESUMED;
37 void
38 TAO_Resume_Handle::handle_input_return_value_hook (int& return_value)
40 // RT8248: The return value is only changed from 1 to 0 if:
41 // 1) the handle_input return value wants an immediate callback
42 // on the handle (i.e. will return "1")
43 // 2) this->resume_handle was already called
44 // 3) reactor->resume_handler was called by this->resume_handle
45 // The value is changed because you can't ask for an immediate callback
46 // on a handle that you have already given up ownership of. (RT8248)
47 if ( return_value == 1 &&
48 this->flag_ == TAO_HANDLE_ALREADY_RESUMED &&
49 this->orb_core_ &&
50 this->orb_core_->reactor ()->resumable_handler () &&
51 this->handle_ != ACE_INVALID_HANDLE)
53 // a return value of "1" means "call me back immediately;
54 // but we can't "call me back immediately" on an
55 // already-resumed handle
56 return_value = 0;
58 if (TAO_debug_level > 6)
60 TAOLIB_DEBUG ((LM_DEBUG,
61 "TAO (%P|%t) - Resume_Handle::handle_input_return_value_hook, "
62 "overriding return value of 1 with retval = %d\n",
63 return_value));
66 else if ( return_value == -1 )
68 // this covers the "connection close" case, where you want
69 // to leave the handle suspended if you're return -1 to
70 // remove the handle from the Reactor. (See ChangeLog entry
71 // Fri Dec 16 14:40:54 2005)
72 this->flag_ = TAO_HANDLE_LEAVE_SUSPENDED;
74 if (TAO_debug_level > 6)
76 TAOLIB_DEBUG ((LM_DEBUG,
77 "TAO (%P|%t) - Resume_Handle::handle_input_return_value_hook, "
78 "handle_input returning -1, so handle is not resumed.\n"));
83 TAO_END_VERSIONED_NAMESPACE_DECL