00001
00002
00003
00004
00005
00006
00007
00008 #include "ThreadSynch.h"
00009
00010
00011 ACE_INLINE
00012 OpenDDS::DCPS::TransportSendStrategy::SendMode
00013 OpenDDS::DCPS::TransportSendStrategy::mode() const
00014 {
00015 DBG_ENTRY_LVL("TransportSendStrategy","mode",6);
00016
00017 return mode_;
00018 }
00019
00020 ACE_INLINE
00021 OpenDDS::DCPS::ThreadSynch*
00022 OpenDDS::DCPS::TransportSendStrategy::synch() const
00023 {
00024 DBG_ENTRY_LVL("TransportSendStrategy","synch",6);
00025
00026 return synch_;
00027 }
00028
00029 ACE_INLINE void
00030 OpenDDS::DCPS::TransportSendStrategy::send_start()
00031 {
00032 DBG_ENTRY_LVL("TransportSendStrategy","send_start",6);
00033
00034 GuardType guard(this->lock_);
00035
00036 if (!this->link_released_)
00037 ++this->start_counter_;
00038 }
00039
00040 ACE_INLINE void
00041 OpenDDS::DCPS::TransportSendStrategy::link_released(bool flag)
00042 {
00043 DBG_ENTRY_LVL("TransportSendStrategy","link_released",6);
00044
00045 GuardType guard(this->lock_);
00046 this->link_released_ = flag;
00047 }
00048
00049 ACE_INLINE void
00050 OpenDDS::DCPS::TransportSendStrategy::relink(bool)
00051 {
00052 DBG_ENTRY_LVL("TransportSendStrategy","relink",6);
00053
00054
00055 }
00056
00057 ACE_INLINE void
00058 OpenDDS::DCPS::TransportSendStrategy::suspend_send()
00059 {
00060 DBG_ENTRY_LVL("TransportSendStrategy","suspend_send",6);
00061 GuardType guard(this->lock_);
00062
00063 if (this->mode_ != MODE_TERMINATED && this->mode_ != MODE_SUSPEND) {
00064 this->mode_before_suspend_ = this->mode_;
00065 this->mode_ = MODE_SUSPEND;
00066 }
00067 }
00068
00069 ACE_INLINE void
00070 OpenDDS::DCPS::TransportSendStrategy::resume_send()
00071 {
00072 DBG_ENTRY_LVL("TransportSendStrategy","resume_send",6);
00073 GuardType guard(this->lock_);
00074
00075
00076
00077 if (this->mode_ == MODE_TERMINATED) {
00078 this->header_.length_ = 0;
00079 this->pkt_chain_ = 0;
00080 this->header_complete_ = false;
00081 this->start_counter_ = 0;
00082 this->mode_ = MODE_DIRECT;
00083 this->mode_before_suspend_ = MODE_NOT_SET;
00084 this->delayed_delivered_notification_queue_.clear();
00085
00086 } else if (this->mode_ == MODE_SUSPEND) {
00087 this->mode_ = this->mode_before_suspend_;
00088 this->mode_before_suspend_ = MODE_NOT_SET;
00089 if (this->queue_->size() > 0) {
00090 this->mode_ = MODE_QUEUE;
00091 this->synch_->work_available();
00092 }
00093
00094 } else {
00095 ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: TransportSendStrategy::resume_send The suspend or terminate"
00096 " is not called previously.\n"));
00097 }
00098 }
00099
00100 ACE_INLINE const char*
00101 OpenDDS::DCPS::TransportSendStrategy::mode_as_str(SendMode mode)
00102 {
00103 static const char* SendModeStr[] = { "MODE_NOT_SET",
00104 "MODE_DIRECT",
00105 "MODE_QUEUE",
00106 "MODE_SUSPEND",
00107 "MODE_TERMINATED",
00108 "UNKNOWN"
00109 };
00110
00111 return SendModeStr [mode];
00112 }
00113
00114 ACE_INLINE bool
00115 OpenDDS::DCPS::TransportSendStrategy::isDirectMode()
00116 {
00117 return this->mode_ == MODE_DIRECT;
00118 }
00119
00120 ACE_INLINE ssize_t
00121 OpenDDS::DCPS::TransportSendStrategy::send_bytes(const iovec iov[],
00122 int n,
00123 int& )
00124 {
00125 return send_bytes_i(iov, n);
00126 }
00127
00128 ACE_INLINE ACE_HANDLE
00129 OpenDDS::DCPS::TransportSendStrategy::get_handle()
00130 {
00131 return ACE_INVALID_HANDLE;
00132 }
00133
00134
00135 ACE_INLINE void
00136 OpenDDS::DCPS::TransportSendStrategy::transport_shutdown ()
00137 {
00138 this->transport_shutdown_ = true;
00139 }
00140
00141 ACE_INLINE size_t
00142 OpenDDS::DCPS::TransportSendStrategy::max_message_size() const
00143 {
00144 return 0;
00145 }
00146
00147 ACE_INLINE OpenDDS::DCPS::TransportQueueElement*
00148 OpenDDS::DCPS::TransportSendStrategy::current_packet_first_element() const
00149 {
00150 return this->elems_->peek();
00151 }