Giter Club home page Giter Club logo

Comments (5)

cryptix avatar cryptix commented on May 18, 2024

I'm getting the same on a newly installed pub using [email protected]

from epidemic-broadcast-trees.

dominictarr avatar dominictarr commented on May 18, 2024

great, okay this must have been caused by: https://github.com/dominictarr/epidemic-broadcast-trees/pull/18 (if someone connects who is blocked, disconnect them)

from epidemic-broadcast-trees.

qypea avatar qypea commented on May 18, 2024

Did a little digging and it seems to be a problem with the state tracking between ssb-ebt and this code. It seems to me like when this code ends the connection ssb-ebt doesn't notice, continues trying to use the connection, calls write, and triggers the error.

Here's a workaround patch that seems to get things working again for me. My intent was to make this layer not close the connection itself; rather let the upper layer deal with that and survive the intervening time.

diff --git a/stream.js b/stream.js
index f4646ef..2e975dc 100644
--- a/stream.js
+++ b/stream.js
@@ -79,12 +79,12 @@ EBTStream.prototype.abort = EBTStream.prototype.end = function (err) {
 EBTStream.prototype.canSend = function () {
   var state = this.peer.state.peers[this.remote]
   return (
+    state &&
+    !state.blocked &&
     this.sink &&
     !this.sink.paused &&
     !this.ended && (
-      //missing state means this peer was blocked,
-      //end immediately.
-      state.blocked || state.msgs.length || state.notes
+      state.msgs.length || state.notes
     )
   )
 }
@@ -93,9 +93,7 @@ EBTStream.prototype.resume = function () {
   var state = this.peer.state.peers[this.remote]
   if(!this.sink || this.sink.paused) return
   while(this.canSend()) {
-    if(state.blocked)
-      this.end()
-    else if(state.msgs.length) {
+    if(state.msgs.length) {
       if(this.peer.logging) console.error("EBT:send", JSON.stringify(state.msgs[0], null, 2))
       this.sink.write(state.msgs.shift())
     }

from epidemic-broadcast-trees.

dominictarr avatar dominictarr commented on May 18, 2024

I think the problem was actually in push-stream-to-pull-stream, if you update that to 1.0.3 (reinstall and you'll get it) and i think it should start working again.

from epidemic-broadcast-trees.

qypea avatar qypea commented on May 18, 2024

Updating seems to fix this issue, but introduces another. Unfortunately this means I can't run this fix for long term stability testing until the other issue is fixed. It does appear better though so I'll close this issue for now.

from epidemic-broadcast-trees.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.