Don't fetch an implementation if an option is disabled.
This commit is contained in:
@ -1416,8 +1416,11 @@ def put_read_config(MyDriver):
|
||||
txt += [' if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {']
|
||||
txt += [' continue']
|
||||
txt += [' }']
|
||||
txt += [' set name [dict get $v name]']
|
||||
txt += [' set enabled [string tolower [dict get $v "enabled"]]']
|
||||
txt += [' if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {']
|
||||
txt += [' continue']
|
||||
txt += [' }']
|
||||
txt += [' set name [dict get $v name]']
|
||||
txt += [' set implementation [dict get $v "implementation"]']
|
||||
txt += [' if { !([dict exists $::config_dict $implementation]) } {']
|
||||
txt += [' continue']
|
||||
@ -1427,57 +1430,55 @@ def put_read_config(MyDriver):
|
||||
txt += [' continue']
|
||||
txt += [' }']
|
||||
txt += [' if { [string equal -nocase [dict get $v "driver"] "%s"] } {' % MyDriver['name']]
|
||||
txt += [' if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {']
|
||||
txt += [' if { ![string equal -nocase [SplitReply [%s]] "false"] } {' % MyDriver['simulation_group']]
|
||||
txt += [' set asyncqueue "null"']
|
||||
txt += [' ${ns}::sics_log 9 "[%s] => using null asyncqueue"' % MyDriver['simulation_group']]
|
||||
txt += [' } elseif { [dict exists $v "asyncqueue"] } {']
|
||||
txt += [' set asyncqueue [dict get $v "asyncqueue"]']
|
||||
txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {']
|
||||
txt += [' set IP [dict get $v ip]']
|
||||
txt += [' set PORT [dict get $v port]']
|
||||
txt += [' }']
|
||||
txt += [' } else {']
|
||||
txt += [' if { [dict exists $v "asyncprotocol"] } {']
|
||||
txt += [' set asyncprotocol [dict get $v "asyncprotocol"]']
|
||||
txt += [' } else {']
|
||||
txt += [' set asyncprotocol ${name}_protocol']
|
||||
txt += [' MakeAsyncProtocol ${asyncprotocol}']
|
||||
txt += [' if { [dict exists $v "terminator"] } {']
|
||||
txt += [' ${asyncprotocol} sendterminator "[dict get $v "terminator"]"']
|
||||
txt += [' ${asyncprotocol} replyterminator "[dict get $v "terminator"]"']
|
||||
txt += [' }']
|
||||
txt += [' }']
|
||||
txt += [' set asyncqueue ${name}_queue']
|
||||
txt += [' if { ![string equal -nocase [SplitReply [%s]] "false"] } {' % MyDriver['simulation_group']]
|
||||
txt += [' set asyncqueue "null"']
|
||||
txt += [' ${ns}::sics_log 9 "[%s] => using null asyncqueue"' % MyDriver['simulation_group']]
|
||||
txt += [' } elseif { [dict exists $v "asyncqueue"] } {']
|
||||
txt += [' set asyncqueue [dict get $v "asyncqueue"]']
|
||||
txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {']
|
||||
txt += [' set IP [dict get $v ip]']
|
||||
txt += [' set PORT [dict get $v port]']
|
||||
txt += [' MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}']
|
||||
txt += [' if { [dict exists $v "timeout"] } {']
|
||||
txt += [' ${asyncqueue} timeout "[dict get $v "timeout"]"']
|
||||
txt += [' }']
|
||||
txt += [' } else {']
|
||||
txt += [' if { [dict exists $v "asyncprotocol"] } {']
|
||||
txt += [' set asyncprotocol [dict get $v "asyncprotocol"]']
|
||||
txt += [' } else {']
|
||||
txt += [' set asyncprotocol ${name}_protocol']
|
||||
txt += [' MakeAsyncProtocol ${asyncprotocol}']
|
||||
txt += [' if { [dict exists $v "terminator"] } {']
|
||||
txt += [' ${asyncprotocol} sendterminator "[dict get $v "terminator"]"']
|
||||
txt += [' ${asyncprotocol} replyterminator "[dict get $v "terminator"]"']
|
||||
txt += [' }']
|
||||
txt += [' }']
|
||||
txt += [' set asyncqueue ${name}_queue']
|
||||
txt += [' set IP [dict get $v ip]']
|
||||
txt += [' set PORT [dict get $v port]']
|
||||
txt += [' MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}']
|
||||
txt += [' if { [dict exists $v "timeout"] } {']
|
||||
txt += [' ${asyncqueue} timeout "[dict get $v "timeout"]"']
|
||||
txt += [' }']
|
||||
txt += [' }']
|
||||
if 'make_args' in MyDriver:
|
||||
txt += [' set arg_list [list]']
|
||||
txt += [' foreach arg {' + MyDriver['make_args'] + '} {']
|
||||
txt += [' if {[dict exists $v $arg]} {']
|
||||
txt += [' lappend arg_list "[dict get $v $arg]"']
|
||||
txt += [' } else {']
|
||||
txt += [' ${ns}::sics_log 9 "Missing configuration value $arg"']
|
||||
txt += [' error "Missing configuration value $arg"']
|
||||
txt += [' }']
|
||||
txt += [' }']
|
||||
txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {']
|
||||
txt += [' add_%s ${name} ${IP} ${PORT} {*}$arg_list' % MyDriver['name']]
|
||||
txt += [' foreach arg {' + MyDriver['make_args'] + '} {']
|
||||
txt += [' if {[dict exists $v $arg]} {']
|
||||
txt += [' lappend arg_list "[dict get $v $arg]"']
|
||||
txt += [' } else {']
|
||||
txt += [' add_%s ${name} "aqadapter" ${asyncqueue} {*}$arg_list' % MyDriver['name']]
|
||||
txt += [' ${ns}::sics_log 9 "Missing configuration value $arg"']
|
||||
txt += [' error "Missing configuration value $arg"']
|
||||
txt += [' }']
|
||||
txt += [' }']
|
||||
txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {']
|
||||
txt += [' add_%s ${name} ${IP} ${PORT} {*}$arg_list' % MyDriver['name']]
|
||||
txt += [' } else {']
|
||||
txt += [' add_%s ${name} "aqadapter" ${asyncqueue} {*}$arg_list' % MyDriver['name']]
|
||||
txt += [' }']
|
||||
else:
|
||||
txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {']
|
||||
txt += [' add_%s ${name} ${IP} ${PORT}' % MyDriver['name']]
|
||||
txt += [' } else {']
|
||||
txt += [' add_%s ${name} "aqadapter" ${asyncqueue}' % MyDriver['name']]
|
||||
txt += [' }']
|
||||
txt += [' }']
|
||||
txt += [' if { [string equal -nocase ${asyncqueue} "sct"] } {']
|
||||
txt += [' add_%s ${name} ${IP} ${PORT}' % MyDriver['name']]
|
||||
txt += [' } else {']
|
||||
txt += [' add_%s ${name} "aqadapter" ${asyncqueue}' % MyDriver['name']]
|
||||
txt += [' }']
|
||||
txt += [' }']
|
||||
txt += [' }']
|
||||
txt += [' }']
|
||||
|
Reference in New Issue
Block a user