Better explain what 1<<22-24 means for packet length
This commit is contained in:
		
							
								
								
									
										3
									
								
								rpc.go
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								rpc.go
									
									
									
									
									
								
							| @@ -364,7 +364,8 @@ func (l *Libvirt) requestStream(proc uint32, program uint32, payload []byte, out | ||||
| } | ||||
|  | ||||
| func (l *Libvirt) sendStream(serial uint32, proc uint32, program uint32, stream io.Reader, abort chan bool) error { | ||||
| 	buf := make([]byte, 1<<22-24) | ||||
| 	// Keep total packet length under 4 MiB to follow possible limitation in libvirt server code | ||||
| 	buf := make([]byte, 4*MiB-constants.HeaderSize) | ||||
| 	for { | ||||
| 		select { | ||||
| 		case <-abort: | ||||
|   | ||||
							
								
								
									
										24
									
								
								units.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								units.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| // Copyright 2016 The go-libvirt Authors. | ||||
| // | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| //   http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
|  | ||||
| // This module provides different units of measurement to make other | ||||
| // code more readable. | ||||
|  | ||||
| package libvirt | ||||
|  | ||||
| const ( | ||||
| 	B   = 1 | ||||
| 	KiB = 1024 * B | ||||
| 	MiB = 1024 * KiB | ||||
| ) | ||||
		Reference in New Issue
	
	Block a user