Compare commits
2 Commits
445f596895
...
199ff0f756
Author | SHA1 | Date |
---|---|---|
Johannes Kimmel | 199ff0f756 | |
Johannes Kimmel | a9cfa381af |
15
main.go
15
main.go
|
@ -17,7 +17,6 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
NUM_MSGS = 64
|
||||
NUM_BUFFERS = 1
|
||||
)
|
||||
|
||||
|
@ -55,9 +54,8 @@ func (vx *vx46) transform46(msgs4 []ipv4.Message, msgs6 []ipv6.Message) error {
|
|||
}
|
||||
|
||||
func (vx *vx46) forward46() error {
|
||||
//msgs4, msgs6 := prepareMsgs(vx.mtu)
|
||||
msgs4 := [NUM_MSGS]ipv4.Message{}
|
||||
msgs6 := [NUM_MSGS]ipv6.Message{}
|
||||
msgs4 := make([]ipv4.Message, vx.buffers)
|
||||
msgs6 := make([]ipv6.Message, vx.buffers)
|
||||
|
||||
for i := range msgs6 {
|
||||
msgs4[i].Buffers = [][]byte{make([]byte, vx.mtu)}
|
||||
|
@ -66,7 +64,7 @@ func (vx *vx46) forward46() error {
|
|||
|
||||
for {
|
||||
n, err := vx.pc4.ReadBatch(msgs4[:], 0)
|
||||
if n > NUM_MSGS*4/3 {
|
||||
if n > vx.buffers*3/4 {
|
||||
log.Printf("forward46: %d in", n)
|
||||
}
|
||||
if err != nil {
|
||||
|
@ -114,9 +112,8 @@ func (vx *vx46) transform64(msgs6 []ipv6.Message, msgs4 []ipv4.Message) error {
|
|||
}
|
||||
|
||||
func (vx *vx46) forward64() error {
|
||||
//msgs4, msgs6 := prepareMsgs(vx.mtu)
|
||||
msgs4 := [NUM_MSGS]ipv4.Message{}
|
||||
msgs6 := [NUM_MSGS]ipv6.Message{}
|
||||
msgs4 := make([]ipv4.Message, vx.buffers)
|
||||
msgs6 := make([]ipv6.Message, vx.buffers)
|
||||
|
||||
for i := range msgs6 {
|
||||
msgs6[i].Buffers = [][]byte{make([]byte, vx.mtu)}
|
||||
|
@ -126,7 +123,7 @@ func (vx *vx46) forward64() error {
|
|||
|
||||
for {
|
||||
n, err := vx.pc6.ReadBatch(msgs6[:], 0)
|
||||
if n > NUM_MSGS*4/3 {
|
||||
if n > vx.buffers*3/4 {
|
||||
log.Printf("forward64: %d in", n)
|
||||
}
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue