Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jwenjian I wonder if using
await self.reader.readexactly(4)
[1] would be better?although that raises
IncompleteReadError
[2] which we would have to handle somehow.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also relevant[3].
I do not know which is better. Let me know your thoughts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
readexactly
method is better if we have a proper way to handle theIncompleteReadError
log an error and ignore it or raise it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems there is no
timeout
in theread*()
functions?So if the
readexactly(4)
raises an error, it means that there is no more data and the read partial bytes(length must be less than 4) is not part of an valid SMPP PDU, so I suggest to abandon it then continue the while loop.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, like the way you handle the message body in Line 1900, it should works fine to the headers.
also don't know which is better, so maybe we can use the way I do in this pr util we find out a more efficient way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your input. I think we can start with this and improve if/when it becomes neccessary
I'll think about it some more.