diff options
author | David Barksdale <amatus@amatus.name> | 2014-08-18 20:35:32 -0500 |
---|---|---|
committer | David Barksdale <amatus@amatus.name> | 2014-08-18 20:35:32 -0500 |
commit | dae2186cb8be4c1975244fc7dbf6220e971993bf (patch) | |
tree | 9a79e9499c060e604929edf76bd10fe14e594361 /src/cljs/gnunet_web/transport.cljs | |
parent | fcfe2f3826a076edf783c03a9a075d28afa82892 (diff) |
Fix errors due to parsing failure
Diffstat (limited to 'src/cljs/gnunet_web/transport.cljs')
-rw-r--r-- | src/cljs/gnunet_web/transport.cljs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cljs/gnunet_web/transport.cljs b/src/cljs/gnunet_web/transport.cljs index 86bd58a..e39cece 100644 --- a/src/cljs/gnunet_web/transport.cljs +++ b/src/cljs/gnunet_web/transport.cljs @@ -74,11 +74,12 @@ (let [message-channel (js/MessageChannel.)] (set! (.-onmessage (.-port1 message-channel)) (fn [event] - (let [message (first (.-v ((parse-message-types - #{parse-hello}) - (.-data event))))] - (callback (:message message))))) - (client-connect "transport" "web app" (.-port2 message-channel)) + (let [message (.-v ((parse-message-types #{parse-hello}) + (.-data event)))] + (if (not (= :nothing message)) + (callback (:message (first message))))))) + (client-connect "transport" "web app (monitor)" + (.-port2 message-channel)) (.postMessage (.-port1 message-channel) (into-array (encode-start-message {}))))) @@ -91,7 +92,8 @@ #{parse-peer-iterate-reply}) (.-data event))))] (callback (:message message))))) - (client-connect "transport" "web app" (.-port2 message-channel)) + (client-connect "transport" "web app (monitor-peers)" + (.-port2 message-channel)) (.postMessage (.-port1 message-channel) (into-array (encode-monitor-peer-request-message {}))))) |