[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-common-dev
Subject:    [Common-dev] CR: Fixes PR 256508 - Requests after the first for SR
From:       Chytanya Karusala <ckarusala () real ! com>
Date:       2010-01-19 22:03:24
Message-ID: 6.2.5.6.2.20100119140122.0836b040 () real ! com
[Download RAW message or body]

Synopsis
========
This CR fixes PR 256508: Requests after the first for SR RTP live 
streams give 404

Branch : HEAD
Suggested Reviewer : Dean, Jamie

Description
=========
On win2k3 & win2k8, MemoryMapDataFile::Stat() fails in CreateFile() 
if the file was originally opened with write access. MSDN states that 
dwShareMode argument (which is different from the access mode) for 
the subsequent CreateFile() calls should match the share mode with 
which the file is originally opened. Interestingly, this does not 
create a problem in Windows XP. Fix is to retry with share mode 
FILE_SHARE_READ | FILE_SHARE_WRITE when the earlier call with just 
FILE_SHARE_READ failed but the error is not "file not found". I was 
going to include this change under HELIX_FEATURE_SERVER but noticed 
that there are other places in this file which were already doing this.

Files Changed:
============
common/fileio/platform/win/mmapdatf.cpp

Testing Performed
=================
Unit Tests:
- Verified with repeated wget requests to files and it is not 
resulting in 404 anymore.

Integration Tests:
- None

Leak Tests:

Performance Tests:
- None

Build verified: win32-i386-vc7
Platform tested : win32-i386-vc7

Thanks,
Chytanya

Index: platform/win/mmapdatf.cpp
===================================================================
RCS file: /cvsroot/common/fileio/platform/win/mmapdatf.cpp,v
retrieving revision 1.14
diff -u -r1.14 mmapdatf.cpp
--- platform/win/mmapdatf.cpp   6 Jul 2007 20:35:17 -0000       1.14
+++ platform/win/mmapdatf.cpp   19 Jan 2010 21:39:35 -0000
@@ -790,6 +790,19 @@
                  NULL);
      }

+    if (hUse == INVALID_HANDLE_VALUE && ERROR_FILE_NOT_FOUND != 
::GetLastError())
+    {
+        // Perhaps the file is mapped read/write.  We'll have to try 
it like that too.
+        bClose = TRUE;
+        hUse = CreateFile(OS_STRING(m_pFilename),
+                               0, //query
+                               FILE_SHARE_READ | FILE_SHARE_WRITE,
+                               NULL,
+                               OPEN_EXISTING,
+                               FILE_ATTRIBUTE_NORMAL,
+                               NULL);
+    }
+
      if (hUse == INVALID_HANDLE_VALUE)
      {
         return HXR_FAIL;


_______________________________________________
Common-dev mailing list
Common-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/common-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic