Revision 7c5d2771 mininet/util.py

View differences:

mininet/util.py
543 543
    return
544 544

  
545 545
def waitListening( client=None, server='127.0.0.1', port=80, timeout=None ):
546
    "Wait until server is listening on port"
546
    """Wait until server is listening on port.
547
       returns True if server is listening"""
547 548
    run = ( client.cmd if client else
548 549
                partial( quietRun, shell=True ) )
549 550
    if not run( 'which telnet' ):
......
554 555
    time = 0
555 556
    while 'Connected' not in run( cmd ):
556 557
        if timeout:
558
            print time
557 559
            if time >= timeout:
558 560
                error( 'could not connect to %s on port %d\n'
559 561
                       % ( server, port ) )
560
                break
562
                return False
561 563
        output('waiting for', server,
562 564
               'to listen on port', port, '\n')
563 565
        sleep( .5 )
564 566
        time += .5
565

  
567
    return True

Also available in: Unified diff