mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 09:03:21 +00:00 
			
		
		
		
	Implement ack, use instead of sync to signal continuing upload.
This commit is contained in:
		| @@ -673,9 +673,6 @@ GuacUI.Client.attach = function(guac) { | ||||
|     // Get display element | ||||
|     var guac_display = guac.getDisplay(); | ||||
|  | ||||
|     // Array of any pending uploads | ||||
|     var pending_uploads = []; | ||||
|  | ||||
|     /* | ||||
|      * Update the scale of the display when the client display size changes. | ||||
|      */ | ||||
| @@ -773,18 +770,6 @@ GuacUI.Client.attach = function(guac) { | ||||
|         GuacUI.sessionState.setProperty("clipboard", data); | ||||
|     }; | ||||
|  | ||||
|     // Handle any pending uploads when server is ready | ||||
|     guac.onsync = function() { | ||||
|  | ||||
|         // Pull top pending upload from head of list | ||||
|         var pending_upload = pending_uploads.shift(); | ||||
|  | ||||
|         // If still more to upload, add to tail of list | ||||
|         if (pending_upload && pending_upload()) | ||||
|             pending_uploads.push(pending_upload); | ||||
|  | ||||
|     }; | ||||
|  | ||||
|     /* | ||||
|      * Prompt to download file when file received. | ||||
|      */ | ||||
| @@ -1112,9 +1097,9 @@ GuacUI.Client.attach = function(guac) { | ||||
|             stream.onerror = function() { | ||||
|                 valid = false; | ||||
|             }; | ||||
|             | ||||
|             // Create upload callback | ||||
|             function continueUpload() { | ||||
|  | ||||
|             // Continue upload when acknowledged | ||||
|             stream.onack = function() { | ||||
|  | ||||
|                 // Abort upload if stream is invalid | ||||
|                 if (!valid) return false; | ||||
| @@ -1130,19 +1115,11 @@ GuacUI.Client.attach = function(guac) { | ||||
|                 offset += 4096; | ||||
|  | ||||
|                 // If at end, stop upload | ||||
|                 if (offset >= bytes.length) { | ||||
|                 if (offset >= bytes.length) | ||||
|                     stream.close(); | ||||
|                     return false; | ||||
|                 } | ||||
|  | ||||
|                 // Otherwise, continue | ||||
|                 return true; | ||||
|  | ||||
|             }; | ||||
|  | ||||
|             // Add to list, ready for sending | ||||
|             pending_uploads.push(continueUpload); | ||||
|  | ||||
|         }; | ||||
|         reader.readAsArrayBuffer(file); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user