linxGnu / gosmpp

Smpp (3.4) Client Library for Go
Apache License 2.0
155 stars 62 forks source link

When using WindowedRequestTracking, if the enquire_link expires, the bind is closed but doesnt restart #151

Open laduchesneau opened 2 months ago

laduchesneau commented 2 months ago

The OnExpiredPduRequest is using the transceivable.go Close() function. This uses the ExplicitClosing state. Therefor the OnClosed() and the session restart() functions are not called.

if t.settings.OnExpiredPduRequest != nil {
    bindClose := t.settings.OnExpiredPduRequest(request.PDU)
    if bindClose {
        _ = t.Close()
    }
}

The normal behavior when any PDU expires, the user should be is given the choice to restart the bind by returning true to the closeBind variable. When its requested, the ConnectionIssue state should be used.

if t.settings.OnExpiredPduRequest != nil {
    bindClose := t.settings.OnExpiredPduRequest(request.PDU)
    if bindClose {
        t.closing(ConnectionIssue)
    }
}

func (t *transceivable) closing(state State) {
    if atomic.CompareAndSwapInt32(&t.aliveState, Alive, Closed) {
        t.in.closing(StoppingProcessOnly)
        t.out.closing(StoppingProcessOnly)

        // close underlying conn
        _ = t.conn.Close()

        // notify transceiver closed
        if t.settings.OnClosed != nil {
            t.settings.OnClosed(state)
        }
    }
    return
}
icoder-new commented 1 week ago

Hi, is this related to issue #154 problem?

laduchesneau commented 1 week ago

No. its for #152. This issue does not impact OnAllPdu configs.