summaryrefslogtreecommitdiffhomepage
path: root/pkg/flipcall/flipcall_unsafe.go
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2019-09-03 15:09:34 -0700
committergVisor bot <gvisor-bot@google.com>2019-09-03 15:10:51 -0700
commiteb94066ef26fc95d6b645124642b4f1248ad5e11 (patch)
tree049b9d0fad990294dafc7db723e577d809aa7299 /pkg/flipcall/flipcall_unsafe.go
parent648170f527c4dc57f6dcf35bdb13e31b99ca022c (diff)
Ensure that flipcall.Endpoint.Shutdown() shuts down inactive peers.
PiperOrigin-RevId: 267022978
Diffstat (limited to 'pkg/flipcall/flipcall_unsafe.go')
-rw-r--r--pkg/flipcall/flipcall_unsafe.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/flipcall/flipcall_unsafe.go b/pkg/flipcall/flipcall_unsafe.go
index 7c8977893..73e6eef29 100644
--- a/pkg/flipcall/flipcall_unsafe.go
+++ b/pkg/flipcall/flipcall_unsafe.go
@@ -19,15 +19,15 @@ import (
"unsafe"
)
-// Packets consist of an 8-byte header followed by an arbitrarily-sized
+// Packets consist of a 16-byte header followed by an arbitrarily-sized
// datagram. The header consists of:
//
// - A 4-byte native-endian connection state.
//
// - A 4-byte native-endian datagram length in bytes.
+//
+// - 8 reserved bytes.
const (
- sizeofUint32 = unsafe.Sizeof(uint32(0))
-
// PacketHeaderBytes is the size of a flipcall packet header in bytes. The
// maximum datagram size supported by a flipcall connection is equal to the
// length of the packet window minus PacketHeaderBytes.
@@ -35,7 +35,7 @@ const (
// PacketHeaderBytes is exported to support its use in constant
// expressions. Non-constant expressions may prefer to use
// PacketWindowLengthForDataCap().
- PacketHeaderBytes = 2 * sizeofUint32
+ PacketHeaderBytes = 16
)
func (ep *Endpoint) connState() *uint32 {
@@ -43,7 +43,7 @@ func (ep *Endpoint) connState() *uint32 {
}
func (ep *Endpoint) dataLen() *uint32 {
- return (*uint32)((unsafe.Pointer)(ep.packet + sizeofUint32))
+ return (*uint32)((unsafe.Pointer)(ep.packet + 4))
}
// Data returns the datagram part of ep's packet window as a byte slice.