]> gitweb.factorcode.org Git - factor.git/commitdiff
fixed ismaster result eval
authorSascha Matzke <sascha.matzke@didolo.org>
Wed, 11 Aug 2010 04:54:43 +0000 (06:54 +0200)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 28 Sep 2010 20:15:55 +0000 (15:15 -0500)
extra/mongodb/connection/connection.factor

index 17a0494bf7c55ecedbcd5e8c72eadccb7b282ace..7dea9389e0b79b2cf7199e527f8b179537ac2952 100644 (file)
@@ -2,7 +2,7 @@ USING: accessors arrays assocs byte-vectors checksums
 checksums.md5 constructors continuations destructors fry
 hashtables io.encodings.binary io.encodings.string
 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 ;
 IN: mongodb.connection
 
@@ -112,10 +112,13 @@ CONSTRUCTOR: mdb-connection ( instance -- mdb-connection ) ;
    ":" split [ first ] [ second string>number ] bi ; inline
 
 : eval-ismaster-result ( node result -- )
-   [ [ "ismaster" ] dip at >integer 1 = >>master? drop ]
-   [ [ "remote" ] dip at
-     [ split-host-str <inet> f <mdb-node> >>remote ] when*
-     drop ] 2bi ;
+   [
+        [ "ismaster" ] dip at dup string?
+        [ >integer 1 = ] [ ] if >>master? drop
+   ] [
+        [ "remote" ] dip at
+        [ split-host-str <inet> f <mdb-node> >>remote ] when* drop
+    ] 2bi ;
 
 : check-node ( mdb node --  )
    [ <mdb-connection> &dispose ] dip