return SOCKET_ERROR;\r
}\r
\r
- IBSP_CHANGE_SOCKET_STATE( socket_info, IBSP_DUPLICATING_OLD );\r
-\r
- /* We changed the state - remove from connection map. */\r
- ibsp_conn_remove( socket_info );\r
-\r
- cl_spinlock_release( &socket_info->mutex );\r
-\r
/* Create a GUID to use as unique identifier for this duplication. */\r
UuidCreate( &guid );\r
create_name( fname, dwProcessId, &guid );\r
PAGE_READWRITE, 0, sizeof(struct ibsp_duplicate_info), fname );\r
if( !h_dup_info )\r
{\r
+ cl_spinlock_release( &socket_info->mutex );\r
IBSP_ERROR_EXIT(\r
("CreateFileMapping for %s failed with %d\n",\r
fname, GetLastError()) );\r
dup_info = MapViewOfFile( h_dup_info, FILE_MAP_WRITE, 0, 0, 0 );\r
if( !dup_info )\r
{\r
+ cl_spinlock_release( &socket_info->mutex );\r
IBSP_ERROR_EXIT(\r
("MapViewOfFile failed with %d\n", GetLastError()) );\r
CloseHandle( h_dup_info );\r
h_target_process = OpenProcess( PROCESS_DUP_HANDLE, FALSE, dwProcessId );\r
if( !h_target_process )\r
{\r
+ cl_spinlock_release( &socket_info->mutex );\r
IBSP_ERROR_EXIT(\r
("OpenProcess failed with %d\n", GetLastError()) );\r
CloseHandle( h_dup_info );\r
h_target_process, &h_target_dup_info, 0, TRUE,\r
DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS ) )\r
{\r
+ cl_spinlock_release( &socket_info->mutex );\r
IBSP_ERROR_EXIT(\r
("DuplicateHandle failed with %d\n", GetLastError()) );\r
CloseHandle( h_target_process );\r
+ CloseHandle( h_dup_info );\r
*lpErrno = WSAENETDOWN;\r
return SOCKET_ERROR;\r
}\r
\r
CloseHandle( h_target_process );\r
+ CloseHandle( h_dup_info );\r
\r
CL_ASSERT( !((ULONG_PTR)h_target_dup_info >> 32) );\r
lpProtocolInfo->dwProviderReserved = (DWORD)(ULONG_PTR)h_target_dup_info;\r
\r
socket_info->duplicate.identifier = guid;\r
\r
+ IBSP_CHANGE_SOCKET_STATE( socket_info, IBSP_DUPLICATING_OLD );\r
+\r
memset( &reason, 0, sizeof(reason) );\r
reason.type = DISC_DUPLICATING;\r
reason.duplicating.identifier = guid;\r
*/\r
ib_disconnect( socket_info, &reason );\r
\r
+ /* We changed the state - remove from connection map. */\r
+ ibsp_conn_remove( socket_info );\r
+\r
+ cl_spinlock_release( &socket_info->mutex );\r
+\r
wait_cq_drain( socket_info );\r
\r
cl_spinlock_acquire( &socket_info->mutex );\r