Changeset 429

Show
Ignore:
Timestamp:
03/05/07 21:45:11 (17 years ago)
Author:
jwoithe
Message:

Fix Ieee1394Service::freeIsoChannel() so it actually deallocates a channel
and its bandwidth. In short, unregisterIsoChannel() returns false on error
and (most importantly) one can't call unregisterIsoChannel() before
raw1394_bandwidth_modify() and raw1394_channel_modify() because it wipes the
very information one needs for these calls to succeed.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/streaming-rework/src/libieee1394/ieee1394service.cpp

    r424 r429  
    702702        case AllocGeneric: 
    703703            debugOutput(DEBUG_LEVEL_VERBOSE, " allocated using generic routine...\n" ); 
    704             if (unregisterIsoChannel(c)) { 
     704            debugOutput(DEBUG_LEVEL_VERBOSE, " freeing %d bandwidth units...\n", m_channels[c].bandwidth ); 
     705            if (raw1394_bandwidth_modify(m_handle, m_channels[c].bandwidth, RAW1394_MODIFY_FREE) !=0) { 
     706                debugWarning("Failed to deallocate bandwidth\n"); 
     707            } 
     708            debugOutput(DEBUG_LEVEL_VERBOSE, " freeing channel %d...\n", m_channels[c].channel ); 
     709            if (raw1394_channel_modify (m_handle, m_channels[c].channel, RAW1394_MODIFY_FREE) != 0) { 
     710                debugWarning("Failed to free channel\n"); 
     711            } 
     712            if (!unregisterIsoChannel(c)) 
    705713                return false; 
    706             } else { 
    707                 debugOutput(DEBUG_LEVEL_VERBOSE, " freeing %d bandwidth units...\n", m_channels[c].bandwidth ); 
    708                 if (raw1394_bandwidth_modify(m_handle, m_channels[c].bandwidth, RAW1394_MODIFY_FREE) !=0) { 
    709                     debugWarning("Failed to deallocate bandwidth\n"); 
    710                 } 
    711                 debugOutput(DEBUG_LEVEL_VERBOSE, " freeing channel %d...\n", m_channels[c].channel ); 
    712                 if (raw1394_channel_modify (m_handle, m_channels[c].channel, RAW1394_MODIFY_FREE) != 0) { 
    713                     debugWarning("Failed to free channel\n"); 
    714                 } 
    715                 return true; 
    716             } 
     714            return true; 
    717715             
    718716        case AllocCMP: 
    719717            debugOutput(DEBUG_LEVEL_VERBOSE, " allocated using IEC61883 CMP...\n" ); 
    720             if (unregisterIsoChannel(c)) { 
     718            debugOutput(DEBUG_LEVEL_VERBOSE, " performing IEC61883 CMP disconnect...\n" ); 
     719            if(iec61883_cmp_disconnect( 
     720                    m_handle,  
     721                    m_channels[c].xmit_node | 0xffc0, 
     722                    m_channels[c].xmit_plug, 
     723                    m_channels[c].recv_node | 0xffc0, 
     724                    m_channels[c].recv_plug, 
     725                    m_channels[c].channel, 
     726                    m_channels[c].bandwidth) != 0) { 
     727                debugWarning("Could not do CMP disconnect for channel %d!\n",c); 
     728            } 
     729            if (!unregisterIsoChannel(c)) 
    721730                return false; 
    722             } else { 
    723                 debugOutput(DEBUG_LEVEL_VERBOSE, " performing IEC61883 CMP disconnect...\n" ); 
    724                 if(iec61883_cmp_disconnect( 
    725                         m_handle,  
    726                         m_channels[c].xmit_node | 0xffc0, 
    727                         m_channels[c].xmit_plug, 
    728                         m_channels[c].recv_node | 0xffc0, 
    729                         m_channels[c].recv_plug, 
    730                         m_channels[c].channel, 
    731                         m_channels[c].bandwidth) != 0) { 
    732                     debugWarning("Could not do CMP disconnect for channel %d!\n",c); 
    733                 } 
    734             } 
    735731            return true; 
    736732    }