def storeNewTicket(masterKey, ticket, bridge):
 assert (len(masterKey) == const.MASTER_KEY_LENGTH)
 assert (len(ticket) == const.TICKET_LENGTH)
 ticketFile = (const.STATE_LOCATION + const.CLIENT_TICKET_FILE)
 log.debug(("Storing newly received ticket in `%s'." % ticketFile))
 tickets = dict()
 content = util.readFromFile(ticketFile)
 if ((content is not None) and (len(content) > 0)):
  tickets = yaml.safe_load(content)
 tickets[str(bridge)] = [int(time.time()), masterKey, ticket]
 util.writeToFile(yaml.dump(tickets), ticketFile)

def storeNewTicket ( masterKey , ticket , bridge ) : assert ( len ( masterKey ) == const . MASTER_KEY_LENGTH ) assert ( len ( ticket ) == const . TICKET_LENGTH ) ticketFile = ( const . STATE_LOCATION + const . CLIENT_TICKET_FILE ) log . debug ( ( "Storing newly received ticket in `%s'." % ticketFile ) ) tickets = dict ( ) content = util . readFromFile ( ticketFile ) if ( ( content is not None ) and ( len ( content ) > 0 ) ) : tickets = yaml . safe_load ( content ) tickets [ str ( bridge ) ] = [ int ( time . time ( ) ) , masterKey , ticket ] util . writeToFile ( yaml . dump ( tickets ) , ticketFile )
store a new session ticket and the according master key for future use .