[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bugs in errmodel.cc



On Fri, 06 Mar 1998 14:27:33 CST, Gang Xu wrote: 
>Hi,
>
>I fixed these two bugs as you told us. Thanks. However, after I make 
>change to the source code, do I need to recompile the whole NS stuff? I am
>a new user and I really don't know what to do next. Your help is highly
>appreciated.
>
>(I installed the ns-allinone package.)
>
>> Hi!
>> 
>> 	I found two bugs in errormodel.cc :
>> 
>> 	1) The variables errPkt_, errByte_ and errTime must be initialized
>> 	to 0. Otherwise, they can start with very high values. Therefore,
>> many simulations will not experience any loss. That is what I observed on 
>> many simulations. Despite a high error rate, no loss happened. I suggest
>> to add the initialization in errmodel.cc (marked with ^^^)
>> 
>> 	ErrorModel::ErrorModel() : Connector(), unit_(EU_PKT), ranvar_(0),
>>         onlink_(0), enable_(1), firstTime_(1), 
>> 	errPkt_(0), errByte_(0),errTime_(0) // Bug 1 : omission
>> 	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> {
>>         bind("rate_", &rate_);
>>         bind("errPkt_", &errByte_);  // Bug 2 : typo
>> 	      ^^^^^^^^^^^^^^^^^^^
>>         bind("errByte_", &errByte_);
>>         bind("errTime_", &errTime_);
>>         bind("onlink_", &onlink_);
>>         bind("enable_", &onlink_);
>>         bind("off_mac_", &off_mac_);
>> }
>> 
>> 	2) There is a typo, we should have : bind("errPkt_", &errPkt_);

The typo is almost certainly a bug,
but in general, things which are bound (with bind())
don't need to be initialized in C++
because they're initialized in tcl in the
tcl/lib/ns-default.tcl.
errPkt_, errByte_, and errTime_ are all init'ed there.
I'm not sure why therefore you observed them starting with high values
(perhaps because of the typo?).

   -John Heidemann