"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/udp/conn_test.go" between
traefik-v2.3.2.src.tar.gz and traefik-v2.3.3.src.tar.gz

About: Traefik is a cloud native edge router, a reverse proxy and load balancer for HTTP and TCP-based applications.

conn_test.go  (traefik-v2.3.2.src):conn_test.go  (traefik-v2.3.3.src)
package udp package udp
import ( import (
"errors"
"io" "io"
"net" "net"
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func TestConsecutiveWrites(t *testing.T) { func TestConsecutiveWrites(t *testing.T) {
skipping to change at line 27 skipping to change at line 28
ln, err := Listen("udp", addr) ln, err := Listen("udp", addr)
require.NoError(t, err) require.NoError(t, err)
defer func() { defer func() {
err := ln.Close() err := ln.Close()
require.NoError(t, err) require.NoError(t, err)
}() }()
go func() { go func() {
for { for {
conn, err := ln.Accept() conn, err := ln.Accept()
if err == errClosedListener { if errors.Is(err, errClosedListener) {
return return
} }
require.NoError(t, err) require.NoError(t, err)
go func() { go func() {
b := make([]byte, 2048) b := make([]byte, 2048)
b2 := make([]byte, 2048) b2 := make([]byte, 2048)
var n int var n int
var n2 int var n2 int
skipping to change at line 89 skipping to change at line 90
ln, err := Listen("udp", addr) ln, err := Listen("udp", addr)
require.NoError(t, err) require.NoError(t, err)
defer func() { defer func() {
err := ln.Close() err := ln.Close()
require.NoError(t, err) require.NoError(t, err)
}() }()
go func() { go func() {
for { for {
conn, err := ln.Accept() conn, err := ln.Accept()
if err == errClosedListener { if errors.Is(err, errClosedListener) {
return return
} }
require.NoError(t, err) require.NoError(t, err)
go func() { go func() {
b := make([]byte, 2048) b := make([]byte, 2048)
n, err := conn.Read(b) n, err := conn.Read(b)
require.NoError(t, err) require.NoError(t, err)
_, err = conn.Write(b[:n]) _, err = conn.Write(b[:n])
require.NoError(t, err) require.NoError(t, err)
skipping to change at line 186 skipping to change at line 187
ln, err := Listen("udp", addr) ln, err := Listen("udp", addr)
require.NoError(t, err) require.NoError(t, err)
defer func() { defer func() {
err := ln.Close() err := ln.Close()
require.NoError(t, err) require.NoError(t, err)
}() }()
go func() { go func() {
for { for {
conn, err := ln.Accept() conn, err := ln.Accept()
if err == errClosedListener { if errors.Is(err, errClosedListener) {
return return
} }
require.NoError(t, err) require.NoError(t, err)
if withRead { if withRead {
buf := make([]byte, 1024) buf := make([]byte, 1024)
_, err = conn.Read(buf) _, err = conn.Read(buf)
require.NoError(t, err) require.NoError(t, err)
} }
 End of changes. 4 change blocks. 
3 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)