Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session close #8

Open
Prasannagud opened this issue May 15, 2020 · 1 comment · May be fixed by #16
Open

Session close #8

Prasannagud opened this issue May 15, 2020 · 1 comment · May be fixed by #16

Comments

@Prasannagud
Copy link

Hi,
The bind disconnects (session shutdown) happening while read happens .It happens only in receiver mode and when receiving the deliversm request pdu only.It is happening at irregular intervals.
The following is the raw byte sequence sent by the sender
0 1 1 57 49 57 49 55 55 49 56 50 54 52 56 0 0 0 73 67 73 79 0 4 1 0 0 0 0 0 0 0 101 105 100 58 48 32 115 117 98 58 48 48 49 32 100 108 118 114 100 58 48 48 49 32 115 117 98 109 105 116 32 100 97 116 101 58 50 48 48 53 49 52 49 49 50 48 32 100 111 110 101 32 100 97 116 101 58 50 48 48 53 49 52 49 49 50 48 32 115 116 97 116 58 68 69 76 73 86 82 68 32 101 114 114 58 48 48 48 32 84 101 120 116 58 84 101 115 116 32 77 115 103 0 30 0 2 48 0 4 39 0 1 2 20 3 0 10 52 52 49 50 51 52 53 54 55 56

And the receiver received
0 1 1 57 49 57 49 55 55 49 56 50 54 52 56 0 0 0 73 67 73 79 0 4 1 0 0 0 0 0 0 0 101 105 100 58 48 32 115 117 98 58 48 48 49 32 100 108 118 114 100 58 48 48 49 32 115 117 98 109 105 116 32 100 97 116 101 58 50 48 48 53 49 49 50 48 32 100 111 110 101 32 100 97 116 101 58 50 48 48 53 49 52 49 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

And the error was
smpp: pdu length doesn't match read body length 166 != 96.I dont see any issue with the sender.
Any Help urgently required.

Thanks in advance.

@DanielKoehler
Copy link

I believe this because the server doesn't handle partial PDUs being added to the buffer (where the rest of the PDU will be written by the next packet).

In func (d *Decoder) Decode() you could replace:

h := make([]byte, 16)
n, err := d.r.Read(h)
if err != nil {}

with:

var h [16]byte
if _, err = io.ReadFull(d.r, h[:]); err != nil {}

( And a similar io.ReadFull for the body based on the length defined in the header. )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants