#include <sfp.h>
Inheritance diagram for TAO_SFP_Producer_Object:
Public Member Functions | |
TAO_SFP_Producer_Object (TAO_AV_Callback *callback, TAO_AV_Transport *transport, const char *flow_options) | |
virtual int | handle_input (void) |
Protected Attributes | |
CORBA::ULong | credit_sequence_num_ |
Definition at line 258 of file sfp.h.
TAO_SFP_Producer_Object::TAO_SFP_Producer_Object | ( | TAO_AV_Callback * | callback, | |
TAO_AV_Transport * | transport, | |||
const char * | flow_options | |||
) |
Definition at line 1162 of file sfp.cpp.
References ACE_OS::atoi(), and TAO_SFP_Object::max_credit_.
01165 :TAO_SFP_Object (callback,transport), 01166 credit_sequence_num_ (0) 01167 01168 { 01169 TAO_Tokenizer flow_string (sfp_options,':'); 01170 if (flow_string [2] != 0) 01171 { 01172 TAO_Tokenizer options (flow_string[2],'='); 01173 if (options [1] != 0) 01174 this->max_credit_ = ACE_OS::atoi (options[1]); 01175 } 01176 }
int TAO_SFP_Producer_Object::handle_input | ( | void | ) | [virtual] |
Implements TAO_SFP_Object.
Definition at line 1179 of file sfp.cpp.
References flowProtocol::credit::cred_num, flowProtocol::Credit_Msg, credit_sequence_num_, TAO_SFP_Object::current_credit_, TAO_SFP_Object::max_credit_, TAO_SFP_Base::peek_message_type(), TAO_SFP_Base::read_credit_message(), TAO_AV_Transport::recv(), flowProtocol::Start_Msg, and TAO_AV_Protocol_Object::transport_.
01180 { 01181 // A producer can only receive credit messages. 01182 int result; 01183 flowProtocol::MsgType msg_type = flowProtocol::Start_Msg; 01184 result = TAO_SFP_Base::peek_message_type (this->transport_, 01185 msg_type); 01186 if (result < 0) 01187 return result; 01188 switch (msg_type) 01189 { 01190 case flowProtocol::Credit_Msg: 01191 { 01192 flowProtocol::credit credit; 01193 result = TAO_SFP_Base::read_credit_message (this->transport_, 01194 credit, 01195 this->state_.cdr); 01196 if (result < 0) 01197 return result; 01198 if (!this->credit_sequence_num_) 01199 this->credit_sequence_num_ = credit.cred_num; 01200 else 01201 { 01202 // check that the sequence number is above the last sequence number 01203 // else its a duplicate credit message so we can ignore it. 01204 if (credit.cred_num <= this->credit_sequence_num_) 01205 return 0; 01206 else // Update our credit now. 01207 this->current_credit_ = this->max_credit_; 01208 } 01209 } 01210 break; 01211 default: 01212 { 01213 ACE_Message_Block mb (2*this->transport_->mtu ()); 01214 01215 // Ignore the rest of the message by just reading. 01216 this->transport_->recv (mb.rd_ptr (), 01217 mb.size ()); 01218 break; 01219 } 01220 } 01221 return 0; 01222 }