Giter Club home page Giter Club logo

Comments (5)

Eugeny avatar Eugeny commented on July 23, 2024

It's because you're conflating Server with Handler. You should have separate structs that implement these traits. Russh works with one Server instance and multiple Handlers.

handle_session_error is a Server method and you're seeing your own self-incremented <self as Server>.id.

from russh.

Eugeny avatar Eugeny commented on July 23, 2024

In case you've used echoserver example as the base for your code, that's on me as echoserver omits having separate structs to keep the code shorter ✌️

from russh.

unrenamed avatar unrenamed commented on July 23, 2024

@Eugeny, thanks for the quick reply.

It's because you're conflating Server with Handler.

You are right, I am. Now that you said that the traits descriptions make more sense to me.

In case you've used echoserver example as the base for your code

ratatui_app is the one I used as a reference since it was the most suitable to my use case. I understand the urge to keep the code shorter in the examples, but in my case this led to confusion. I'm not suggesting anything though, just sharing my experience with the lib.

from russh.

unrenamed avatar unrenamed commented on July 23, 2024

@Eugeny, I think having separate structs that implement Server and Handler traits might not be acceptable for my use case yet. I've just realized the server runs an infinite loop that renders the view to the connected clients (each client has own terminal handle, of course). This is exactly what ratatui_app does and perhaps this explains the reason behind implementing both traits for one struct, i.e. AppServer. What do you think?

from russh.

Eugeny avatar Eugeny commented on July 23, 2024

Even in this case, you still don't need it to be the same structure. The busy loop does not even reference self (beyond using the shared clients Arc)

from russh.

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.