Ticket #589 (new defect)
Opened 3 years ago
Concatenated SMS aren't correctly parsed
| Reported by: | 3v1n0 | Owned by: | mickey |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | cornucopia/fsogsm | Version: | milestone5.5 |
| Keywords: | Cc: | shr-devel@… mickey@… |
Description
I'm running FSO in my Openmoko Freerunner, but I've noticed an issue with concatenated SMSs... It happens very often when I receive a multipart-SMS that It doesn't get parsed correctly and I find the log line saying "Got new fragment for still-incomplete concatenated SMS".
I've tried to debug this, and I guess that this is mostly due to the async nature of the atsms's _handleIncomingSms "callback" function...
In fact, when many "+CMT" are detected simultaneously the "handleIncomingSms" function is called and, after acknowledging the message, each fragment is saved using the SmsStorage? class...
However, it seems that the inner "add()" method suffer of a race when the received CMT's are very fast and that method can't check if all the fragments have already been saved since its saving is still in progress!
I mean:
+CMT:fragment1... +CMT:fragment2...
Two instances of handleIncomingSms are called:
handleIncomingSms(fragment1) handleIncomingSms(fragment2)
and thus two instances of SmsStorage?.add()...
SmsStorage.add(fragment1) SmsStorage.add(fragment2)
Now, when the first one has not saved the fragment file to the storage dir, the second instance looks for the first fragment which is not available yet... So here's the issue. :/
