summaryrefslogtreecommitdiffhomepage
path: root/Graphviz.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-05-02 15:52:27 -0400
committerJoey Hess <joeyh@joeyh.name>2017-05-02 17:01:35 -0400
commitf559fcfadd7079140ed64bab68275527f46d334e (patch)
tree1f30f563093a27188a5b1da37aa764f4e58c0393 /Graphviz.hs
parent9456361ed8f6dd094a4c08cc352f9a1fd9d0069f (diff)
downloaddebug-me-f559fcfadd7079140ed64bab68275527f46d334e.tar.gz
add prevEntered pointer
Client requires this always point to the previous Entered it accepted, so a hash chain of Entered is built up, and there is no possibility for ambiguity about which order a client received two Entered activies in. So restoreHashes now has to try every possible combination of known hashes for both prevEntered and prevActivity. That could be significantly more work, but it would be unusual for there to be a lot of known hashes, so it should be ok. --graphviz shows this additional hash chain with grey edges (and leaves out edges identical to the other hash chain) While testing this with an artifical network lag, it turned out that signature verification was failing for Reject messages sent by the user. Didn't quite figure out what was at the bottom of that, but the Activity Entered that was sent back in a Reject message was clearly not useful, because it probably had both its prevEntered and prevActivity hashes set to Nothing (because restoreHashes didn't restore them, because the original Activity Entered was out of the expected chain). So, switched Rejected to use a Hash. (And renamed Rejected to EnteredRejected to make it more clear what it's rejecting.) Also, added a lastAccepted hash to EnteredRejected. This lets the developer find its way back to the accepted chain when some of its input gets rejected. This commit was sponsored by Trenton Cronholm on Patreon.
Diffstat (limited to 'Graphviz.hs')
-rw-r--r--Graphviz.hs31
1 files changed, 15 insertions, 16 deletions
diff --git a/Graphviz.hs b/Graphviz.hs
index 59dba7f..f8f165c 100644
--- a/Graphviz.hs
+++ b/Graphviz.hs
@@ -8,7 +8,6 @@
module Graphviz (graphviz) where
import Types
-import Hash
import CmdLine
import Log
@@ -57,37 +56,37 @@ genGraph opts ls = digraph (Str "debug-me") $ do
, shape Circle
]
linkprev s a h
- (User (ControlMessage c), Nothing) -> showcontrol c l
- (Developer (ControlMessage c), Nothing) -> showcontrol c l
+ (User (ControlMessage c), Nothing) -> showcontrol c
+ (Developer (ControlMessage c), Nothing) -> showcontrol c
_ -> return ()
- showcontrol (Control (Rejected ar) _) l = do
- let hr = hash ar
+ showcontrol (Control (EnteredRejected hr _) _) = do
let rejstyle =
[ xcolor Red
, Style [dashed, filled]
]
- let nodename = display $ "Rejected " <> display hr
+ let nodename = display $ "Rejected: " <> display hr
node nodename $ rejstyle ++
[ textLabel "Rejected"
, shape BoxShape
]
- showactivity rejstyle $ Log
- { loggedMessage = Developer (ActivityMessage ar)
- , loggedHash = Just hr
- , loggedTimestamp = loggedTimestamp l
- }
edge nodename (display hr) rejstyle
- showcontrol _ _ = return ()
-
- linkprev s a h = case prevActivity a of
- Nothing -> return ()
- Just p -> link p h s
+ showcontrol _ = return ()
+
+ linkprev s a h = do
+ case prevActivity a of
+ Nothing -> return ()
+ Just p -> link p h s
+ case prevEntered a of
+ Nothing -> return ()
+ Just p -> link p h (s ++ enteredpointerstyle)
link a b s = edge (display a) (display b) $ s ++
if graphvizShowHashes opts
then [ textLabel (prettyDisplay a) ]
else []
+ enteredpointerstyle = [ xcolor Gray ]
+
xcolor :: X11Color -> Attribute
xcolor c = Color [toWC $ X11Color c]