Changeset 4519
 Timestamp:
 10/16/09 16:00:34 (7 years ago)
 Files:

 1 modified
Legend:
 Unmodified
 Added
 Removed

vic/branches/cc/cc/tfwc_sndr.cpp
r4518 r4519 183 183 184 184 // detect loss 185 // @begin: aoa_ 185 // @begin: aoa_+1 186 186 // @end: mvec_[DUPACKS]  1 187 is_loss_ = detect_loss(mvec_[DUPACKS1]1, aoa_ );187 is_loss_ = detect_loss(mvec_[DUPACKS1]1, aoa_+1); 188 188 189 189 // TFWC is not turned on (i.e., no packet loss yet) … … 237 237 // number of seqvec elements 238 238 // (i.e., number of packets that this AckVec is representing) 239 int num Elm = ends_  begins_;239 int num_elm = ends_  begins_; 240 240 241 241 // number of AckVec chunks 242 int x = num Elm%BITLEN;243 int num_chunks = num Elm/BITLEN + (x > 0);242 int x = num_elm%BITLEN; 243 int num_chunks = num_elm/BITLEN + (x > 0); 244 244 245 245 int i, j, k = 0; 246 // start of seqvec 247 // int start = jacked_;248 int start = begins_; // lowest seqno246 247 // start of seqvec (lowest seqno) 248 int start = begins_; 249 249 250 250 for (i = 0; i < num_chunks1; i++) { … … 256 256 } 257 257 } 258 258 259 int a = (x == 0) ? BITLEN : x; 259 260 for (i = a; i > 0; i) { … … 265 266 266 267 // therefore, the number of seqvec is: 267 int num_seqvec = num Elm  num_loss_;268 int num_seqvec = num_elm  num_loss_; 268 269 // printing retrieved sequence numbers from received AckVec 269 270 print_seqvec(num_seqvec); … … 276 277 bool TfwcSndr::detect_loss(int end, int begin) { 277 278 bool ret; // 'true' when there is a loss 278 bool gotIn= false;279 bool is_there = false; 279 280 int count = 0; // packet loss counter 280 281 281 282 // number of tempvec element when no loss 282 int num elm = (end  begin < 0) ? 0 : end  begin;283 u_int32_t tempvec[num elm];283 int num_elm = ((end  begin + 1) < 0) ? 0 : (end  begin + 1); 284 u_int32_t tempvec[num_elm]; 284 285 285 286 // generate tempvec elements 286 287 printf("\tcomparing numbers: ("); 287 for (int i = 0; i < num elm; i++) {288 tempvec[i] = (begin + 1)+ i;288 for (int i = 0; i < num_elm; i++) { 289 tempvec[i] = begin + i; 289 290 printf(" %d", tempvec[i]); 290 291 } printf(" )\n"); 291 292 292 293 // number of seqvec element 293 int num seq = ends_  begins_ num_loss_;294 int num_seqvec = num_elm  num_loss_; 294 295 295 296 // compare tempvec and seqvec 296 for (int i = 0; i < num elm; i++) {297 for (int j = num seq1; j >= 0; j) {297 for (int i = 0; i < num_elm; i++) { 298 for (int j = num_seqvec1; j >= 0; j) { 298 299 if (tempvec[i] == seqvec_[j]) { 299 gotIn= true;300 is_there = true; 300 301 // we found it, so reset count 301 302 count = 0; break; 302 303 } else { 303 gotIn= false;304 is_there = false; 304 305 count++; 305 306 } … … 307 308 308 309 // record the very first lost packet seqno 309 if(! gotIn) {310 if(!is_there) { 310 311 if(!is_first_loss_seen_) 311 312 first_lost_pkt_ = tempvec[i]; … … 315 316 // store tempvec elements for updating loss history 316 317 first_elm_ = tempvec[0]; 317 last_elm_ = first_elm_ + (numelm  1);318 last_elm_ = first_elm_ + num_elm; 318 319 319 320 return ret = (count > 0) ? true : false;