summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Harris <git@peter.is-a-geek.org>2010-12-24 12:31:36 -0500
committerPeter Harris <git@peter.is-a-geek.org>2010-12-24 14:22:52 -0500
commit7a912d080a916cea77e302bcc150ddb2624a5d02 (patch)
treebc5c194cc2a5005f913b21d9b9c43ce0a4290295
parenta8c3801c410ec7acd009d5c14ca1e9b8c4381325 (diff)
Remove extra channel send
This extra send causes deadlocks when the cookie is discarded.
-rw-r--r--xgob.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/xgob.go b/xgob.go
index 44f66c8..47ec431 100644
--- a/xgob.go
+++ b/xgob.go
@@ -276,10 +276,14 @@ func (c *Connection) postReply (seq uint64, reply interface{}) {
return
}
- for i := c.lastSequenceRead; i < seq; i++ {
+ if seq != c.lastSequenceRead {
+ c.reply[c.lastSequenceRead] = nil, false
+ }
+ for i := c.lastSequenceRead + 1; i < seq; i++ {
c.reply[i] <- nil
c.reply[i] = nil, false
}
+
c.reply[seq] <- reply
c.lastSequenceRead = seq
}
@@ -333,7 +337,6 @@ func (c *Connection)connect_auth(name string, data string) {
}
c.Event = make (chan Event, events_before_readblock)
c.reply = make (map [uint64]chan interface{})
- c.lastSequenceRead = 1 // Not really, but this prevents writing to a nil channel
go c.read(in)
}