Code Monkey home page Code Monkey logo

Comments (3)

pattontim avatar pattontim commented on June 3, 2024

Closing until I check with newer version

from vs-streamjsonrpc.

pattontim avatar pattontim commented on June 3, 2024

Experience issue with 2.13.33

Methods involved:

  public static bool removeClient(int id)
   {
     if(Clients.TryGetValue(id, out var client)){
       //client.Rpc.Dispose();
       var timeout = new CancellationTokenSource(2500);
       try
       {
         LogTo.Debug("... starting close handshake");
         client.Socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Closing", timeout.Token)
         .ConfigureAwait(false).GetAwaiter().OnCompleted(() =>
         {
           LogTo.Debug("... close handshake completed");
           client.Rpc.Dispose();
           Clients.TryRemove(id, out _);
           foreach (var c in Clients)
           {
             Task task = c.Value.Rpc.NotifyAsync("removeClient", client.SocketId, client.Name);
             _ = Task.Run(() => task);
           }
         });
       }
       catch (OperationCanceledException ex)
       {
         // normal upon task/token cancellation, disregard
       }      
     }
     return true;
   }

   public static int AddRemoteTarget(string originName, string targetName)
   {
     int originId = GetClientIdByName(originName);
     int targetId = GetClientIdByName(targetName);
     ConnectedClient origin;
     ConnectedClient target;
     if (originId != 0 && Clients.TryGetValue(originId, out origin)
       && targetId != 0 && Clients.TryGetValue(targetId, out target))
     {
       origin.Rpc.AddRemoteRpcTarget(target.Rpc);
       return targetId;
     }
     return -1;
   }

C1 calls AddRemoteTarget("C1","R1"), which succeeds and calls go to R1 successfully.

C1 calls removeClient(id for R1), which succeeds and removes and disposes of R1.

C1 calls AddRemoteTarget("C1","R2") which succeeds. Calls can go to server and succeed with Local invocation, but all calls attempted remotely fail with ConnectionLostException, even though R2 is connected properly.

Info: both client and remote are using simple-jsonrpc with auto-incrementing IDs. However ConnectionLost thrown on server side.

from vs-streamjsonrpc.

AArnott avatar AArnott commented on June 3, 2024

I'm not sure I can help you here. A verbose log that includes all the relevant messages leading up to disconnection may be helpful. The error message we're seeing here suggests it's the other side (simple-jsonrpc) that's hanging up, so I'd think the investigation would need to start there.

from vs-streamjsonrpc.

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.