mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
* fix crash Copy-Item to remote session (#16542) * update comments * remove lock (#16542) Co-authored-by: Sergey Zalyadeev <sergey.zalyadeev@cayosoft.com>
This commit is contained in:
co-authored by
Sergey Zalyadeev
parent
83a809b1f0
commit
da7c52a52f
@@ -220,21 +220,29 @@ namespace System.Management.Automation.Remoting
|
||||
lock (_readSyncObject)
|
||||
{
|
||||
priorityType = DataPriorityType.Default;
|
||||
|
||||
// send data from which ever stream that has data directly.
|
||||
// Send data from which ever stream that has data directly.
|
||||
byte[] result = null;
|
||||
result = _dataToBeSent[(int)DataPriorityType.PromptResponse].ReadOrRegisterCallback(_onSendCollectionDataAvailable);
|
||||
priorityType = DataPriorityType.PromptResponse;
|
||||
SerializedDataStream promptDataToBeSent = _dataToBeSent[(int)DataPriorityType.PromptResponse];
|
||||
if (promptDataToBeSent is not null)
|
||||
{
|
||||
result = promptDataToBeSent.ReadOrRegisterCallback(_onSendCollectionDataAvailable);
|
||||
priorityType = DataPriorityType.PromptResponse;
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
result = _dataToBeSent[(int)DataPriorityType.Default].ReadOrRegisterCallback(_onSendCollectionDataAvailable);
|
||||
priorityType = DataPriorityType.Default;
|
||||
SerializedDataStream defaultDataToBeSent = _dataToBeSent[(int)DataPriorityType.Default];
|
||||
if (defaultDataToBeSent is not null)
|
||||
{
|
||||
result = defaultDataToBeSent.ReadOrRegisterCallback(_onSendCollectionDataAvailable);
|
||||
priorityType = DataPriorityType.Default;
|
||||
}
|
||||
}
|
||||
// no data to return..so register the callback.
|
||||
|
||||
// No data to return..so register the callback.
|
||||
if (result == null)
|
||||
{
|
||||
// register callback.
|
||||
// Register callback.
|
||||
_onDataAvailableCallback = callback;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user