Closed Bug 932192 Opened 12 years ago Closed 12 years ago

[Bluetooth][Gecko] Refactor OPP manager for multiple file transfer

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ben.tian, Assigned: ben.tian)

References

Details

Attachments

(1 file, 1 obsolete file)

Refactor gecko bluetooth first for multiple file transfer. Keep the API and behavior consistent as before. [TODO in bug 897782] Revise opp manager and profile controller after gaia is ready: - remove onconnect/ondisconnect and connect/disconnect functions from opp manager - remove opp from profile controller
Changes: - Add function ConnectInternal() for real socket connecting; Connect() function becomes a dummy function. - Add class SendFileBatch to remember device address and blobs for queuing. - Add logs when 1) socket connects/disconnects/encounters error 2) discard remaing blobs to send 3) process next SendFileBatch - Fix warnings
Attachment #823872 - Flags: review?(echou)
Blocks: 929306
Comment on attachment 823872 [details] [diff] [review] Patch 1 (v1): OPP mgr for multiple file transfer Review of attachment 823872 [details] [diff] [review]: ----------------------------------------------------------------- ok, overall looks good. I'd like to review once again after the new patch is ready. In addition, once Connect() is no more used in Bluetooth File Transfer, we could remove BluetoothProfileController related implementation then. Please file a followup to track on this. Thanks. ::: dom/bluetooth/BluetoothOppManager.cpp @@ +51,5 @@ > static bool sInShutdown = false; > } > > +class mozilla::dom::bluetooth::SendFileBatch { > + public: super-nit: do not indent for the whole class, please. @@ +399,5 @@ > MOZ_ASSERT(NS_IsMainThread()); > > + AppendBlobToSend(aDeviceAddress, aActor); > + if (!mSocket) { > + ProcessNextBatch(); Question: this may fail. Do we need error handling here? @@ +408,5 @@ > > +void > +BluetoothOppManager::AppendBlobToSend(const nsAString& aDeviceAddress, > + BlobParent* aActor) > +{ nit: please add threading assertion check. @@ +439,5 @@ > + BT_LOGR("%s: idx %d", __FUNCTION__, mCurrentBlobIndex); > + ExtractBlobHeaders(); > + StartFileTransfer(); > + > + mSendTransferCompleteFlag = false; Well, setting mSendTransferCompleteFlag to false here is really awkward. I know it's because mSendTransferCompleteFlag will be checked at the beginning of FileTransferComplete(), but it's still not easy to understand. Since mSendTransferCompleteFlag would be set to true in FileTransferComplete(), how about setting it to false in StartFileTransfer()? It seems to be more reasonable.
> ok, overall looks good. I'd like to review once again after the new patch is > ready. In addition, once Connect() is no more used in Bluetooth File > Transfer, we could remove BluetoothProfileController related implementation > then. Please file a followup to track on this. Thanks. The followup bug is bug 897782. I'll remove unused functions once gaia part (bug 929306) is done. > > + AppendBlobToSend(aDeviceAddress, aActor); > > + if (!mSocket) { > > + ProcessNextBatch(); > > Question: this may fail. Do we need error handling here? No need. ProcessNextBatch() here always returns true (means next batch is in queue) as a new batch is just enqueued.
> > > + AppendBlobToSend(aDeviceAddress, aActor); > > > + if (!mSocket) { > > > + ProcessNextBatch(); > > > > Question: this may fail. Do we need error handling here? > > No need. ProcessNextBatch() here always returns true (means next batch is in > queue) as a new batch is just enqueued. Correction: you are right. I missed the socket connection failure case. I'll handle the possible failure in next patch.
Changes: - Revise ConnectInternal() > void return. ProcessNextBatch() returns true only if next batch is in queue. > handle errors with OnSocketConnectError() > close server sockets first in case OnSocketConnectError() nullifies them before disconnection - Add thread safe assertion in functions using mBatches - Move setting of mSendTransferCompleteFlag=false into StartFileTransfer() - Fix nits
Attachment #823872 - Attachment is obsolete: true
Attachment #823872 - Flags: review?(echou)
Attachment #825698 - Flags: review?(echou)
Comment on attachment 825698 [details] [diff] [review] Patch 1 (v2): OPP mgr for multiple file transfer Review of attachment 825698 [details] [diff] [review]: ----------------------------------------------------------------- Looks good. Thanks.
Attachment #825698 - Flags: review?(echou) → review+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: