Changeset 382
- Timestamp:
- 07/27/09 15:40:59 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/branches/sriram/dsa.py
r381 r382 31 31 def main(): 32 32 print "inside main" 33 global n_rcvd, n_right,sync_status,mode,ch,traffic_flag 33 global n_rcvd, n_right,sync_status,mode,ch,traffic_flag,n_attempts 34 34 n_rcvd = 0 35 35 n_right = 0 36 n_attempts = 5 36 37 def send_pkt(self, payload='', eof=False): 37 38 return self.txpath.send_pkt(payload, eof) … … 257 258 else: 258 259 print "sync channel found..channel ",ch,"\n" 259 check_sync= 0260 n_attempts_counter = 0 260 261 mode = "traffic" 261 262 traffic_flag = False … … 266 267 ################################################Communications mode################################# 267 268 if mode == "traffic": 268 print "Inside traffic mode" 269 if check_sync == 0: 270 time.sleep(0.8) 271 if traffic_flag != True: 272 mode = "sync" 273 continue 274 else: 275 check_sync = 1 276 269 print "Inside traffic mode" 270 277 271 nbytes = 15 278 272 pkt_size = 15 … … 303 297 data_pktno += 1 304 298 #print "before sleeping for 10 seconds and value of resend count is",resend_count 305 time.sleep(0.2) 299 time.sleep(0.1 + 0.05*int(random.choice([0,1,2,3]))) 300 301 if traffic_flag != True: 302 n_attempts_counter += 1 303 if n_attempts_counter > n_attempts #get out of the data channel as it seems that the other node is still trying to rendezvous 304 mode = "sync" 305 continue 306 306 307 ch_energy = tb.rxpath.probe.level() #check if primary user is present 307 308 print "channel energy is ",ch_energy,"\n"