Coder Social home page Coder Social logo

Comments (4)

jaroszan avatar jaroszan commented on June 3, 2024 1

Closing since it is not really a bug

from go-diameter.

jaroszan avatar jaroszan commented on June 3, 2024

2 cases should be considered here:

  1. CEA contains no app ids and 5010 code
  2. CEA contains some app ids and 5010 code

from go-diameter.

jaroszan avatar jaroszan commented on June 3, 2024

This is a different issue than I initially thought and it is located in examples/client/client.go, client attempts to reconnect indefinitely regardless of type of error which happens in the progress.

for {
        c, err := connect()
        if err != nil {
            log.Println(err)
            backoff *= 2
            if backoff > 20 {
                backoff = 20
            }
            time.Sleep(time.Duration(backoff) * time.Second)
            continue
        }
        log.Println("Client connected, handshake ok")
        backoff = 1
        <-c.(diam.CloseNotifier).CloseNotify()
        log.Println("Client disconnected")
    }

One might guard oneself against such situations with something like this in case err != nil:

if err.Error()[len(err.Error())-4:] == "5010" {
                log.Println("Permenent error received, aborting connection attempts")
                break
}

But it does not look reliable (eg. err does not come necessarily from parsing CEA).

Such functionality (connect with backoff) can be potentially located somewhere inside sm/client.go and differentiate between type of errors and how to deal with them.

from go-diameter.

fiorix avatar fiorix commented on June 3, 2024

That code in the example/client is an example, not something you'd use for real use cases.

One option is to implement the diam.Conn interface with specific client behavior, supporting things like auto reconnection (with back off), circuit breaker, and whatnot.

from go-diameter.

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.