fixed ismaster result eval

db4
Sascha Matzke 2010-08-11 06:54:43 +02:00 committed by Doug Coleman
parent 0a9ca2124e
commit 0939590955
1 changed files with 8 additions and 5 deletions

View File

@ -2,7 +2,7 @@ USING: accessors arrays assocs byte-vectors checksums
checksums.md5 constructors continuations destructors fry checksums.md5 constructors continuations destructors fry
hashtables io.encodings.binary io.encodings.string hashtables io.encodings.binary io.encodings.string
io.encodings.utf8 io.sockets io.streams.duplex kernel locals io.encodings.utf8 io.sockets io.streams.duplex kernel locals
math math.parser mongodb.cmd mongodb.msg math math.parser mongodb.cmd mongodb.msg strings
namespaces sequences splitting ; namespaces sequences splitting ;
IN: mongodb.connection IN: mongodb.connection
@ -112,10 +112,13 @@ CONSTRUCTOR: mdb-connection ( instance -- mdb-connection ) ;
":" split [ first ] [ second string>number ] bi ; inline ":" split [ first ] [ second string>number ] bi ; inline
: eval-ismaster-result ( node result -- ) : eval-ismaster-result ( node result -- )
[ [ "ismaster" ] dip at >integer 1 = >>master? drop ] [
[ [ "remote" ] dip at [ "ismaster" ] dip at dup string?
[ split-host-str <inet> f <mdb-node> >>remote ] when* [ >integer 1 = ] [ ] if >>master? drop
drop ] 2bi ; ] [
[ "remote" ] dip at
[ split-host-str <inet> f <mdb-node> >>remote ] when* drop
] 2bi ;
: check-node ( mdb node -- ) : check-node ( mdb node -- )
[ <mdb-connection> &dispose ] dip [ <mdb-connection> &dispose ] dip