- if {[catch {z39 connect $t}]} {
- htmlr "Cannot connect to target $t <br>"
- htmlr "</body></html>"
- wabort
- }
- z39 callback init-response
- z39 init
- zwait sessionWait
- if {$sessionWait == -1} {
- htmlr "Cannot initialize with target $t <br>"
- htmlr "</body></html>"
- wabort
+ set thisHost [splitHostSpec $host]
+ if {$thisHost != $oldHost} {
+ catch {z39 disconnect}
+
+ set sessionWait 0
+ if {[catch {z39 connect $thisHost}]} {
+ displayError "Cannot connect to target ${thisHost}" {}
+ html "</body></html>\n"
+ z39 disconnect
+ egw_abort
+ } elseif {$sessionWait == 0} {
+ if {[catch {egw_wait sessionWait 35}]} {
+ displayError "Cannot connect to target ${thisHost}" {}
+ html "</body></html>\n"
+ z39 disconnect
+ egw_abort
+ }
+ if {$sessionWait != 1} {
+ displayError "Cannot connect to target ${thisHost}" {}
+ html "</body></html>\n"
+ z39 disconnect
+ egw_abort
+ }
+ }
+ set sessionWait 0
+ z39 idAuthentication $hist($setNo,idAuthentication)
+ if {[catch {z39 init}]} {
+ displayError "Cannot initialize target ${thisHost}" {}
+ html "</body></html>\n"
+ egw_abort
+ }
+ if {[catch {egw_wait sessionWait 60}]} {
+ displayError "Cannot initialize target ${thisHost}" {}
+ html "</body></html>\n"
+ egw_abort
+ }
+ if {$sessionWait != "1"} {
+ displayError "Cannot initialize target ${thisHost}" {}
+ html "</body></html>\n"
+ egw_abort
+ }
+ if {![z39 initResult]} {
+ displayError "Connection rejected by target ${thisHost}" \
+ [z39 userInformationField]
+ z39 disconnect
+ html "</body></html>\n"
+ egw_abort
+ }