From 68d6c8f16906f066c4e8fae924910c0a3857b948 Mon Sep 17 00:00:00 2001 From: "Bruno G. Albuquerque" Date: Fri, 25 Apr 2008 15:58:44 +0000 Subject: [PATCH] - Remove directory locking for Chain creation until BNode::Lock() is fixed. - Creating 2 chains at the same time will result in problems now, but this is something unlikelly to happen (although not impossible). - Added TODOs related to this. - MDR is usable again inside Haiku and you can actually send emails when creating a mixed inbound/outbound account. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25160 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/mail/MailSettings.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/kits/mail/MailSettings.cpp b/src/kits/mail/MailSettings.cpp index 9a5d721625..707763241c 100644 --- a/src/kits/mail/MailSettings.cpp +++ b/src/kits/mail/MailSettings.cpp @@ -55,7 +55,14 @@ NewMailChain() BDirectory chain_dir(path.Path()); BDirectory outbound_dir(&chain_dir,"outbound"), inbound_dir(&chain_dir,"inbound"); - chain_dir.Lock(); //---------Try to lock the directory + // TODO(bga): We should lock the directory before reading its contents + // and updating the last_issued_chain_id to avoid race conditions in + // case 2 Chains are being created at the same time. Unfortunately, + // calling BNode::Lock() in the directory is preventing the attribute to + // written (and it should not). Add the locking back when this is fixed. + + // TODO(bga): A better way to do all this anyway is to write the chain + // information to the settings message (a new field would be added). int32 id = -1; //-----When inc'ed, we start with 0---- chain_dir.ReadAttr("last_issued_chain_id",B_INT32_TYPE,0,&id,sizeof(id));