Skip to content

Commit

Permalink
remove_some_functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Gekko0114 committed May 1, 2023
1 parent a690d6e commit cf65568
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 37 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ require (
k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9
k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54
k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2
knative.dev/hack v0.0.0-20230417170854-f591fea109b3
knative.dev/hack v0.0.0-20230501013555-7d81248b4638
sigs.k8s.io/yaml v1.3.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -966,8 +966,8 @@ k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 h1:MQ8BAZPZlWk3S9K4a9NCkI
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU=
k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJOIfnislxYlqTj8=
k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/hack v0.0.0-20230417170854-f591fea109b3 h1:+W4WBOq83tfGXKhtv8OB/uJeYqze3zh69GKiz1ucuqk=
knative.dev/hack v0.0.0-20230417170854-f591fea109b3/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/hack v0.0.0-20230501013555-7d81248b4638 h1:9IuXHdwp5jNmIg+0LVTQr8o4u0FYD99uCfynM9tS0XY=
knative.dev/hack v0.0.0-20230501013555-7d81248b4638/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
pgregory.net/rapid v0.3.3 h1:jCjBsY4ln4Atz78QoBWxUEvAHaFyNDQg9+WU62aCn1U=
pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
Expand Down
Empty file modified vendor/k8s.io/code-generator/generate-groups.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ k8s.io/utils/net
k8s.io/utils/pointer
k8s.io/utils/strings/slices
k8s.io/utils/trace
# knative.dev/hack v0.0.0-20230417170854-f591fea109b3
# knative.dev/hack v0.0.0-20230501013555-7d81248b4638
## explicit; go 1.18
knative.dev/hack
# sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2
Expand Down
22 changes: 1 addition & 21 deletions websocket/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,12 @@ type rawConnection interface {
Write(p []byte) (n int, err error)
WriteMessage(op ws.OpCode, p []byte) error
NextReader() (ws.Header, io.Reader, error)
ReadMessage() (messageType ws.OpCode, p []byte, err error)
}

type NetConnExtension struct {
conn net.Conn
}

func NewNetConnExtension(conn net.Conn) *NetConnExtension {
nc := &NetConnExtension{
conn: conn,
}
return nc
}

func (nc *NetConnExtension) Read(p []byte) (n int, err error) {
return nc.conn.Read(p)
}
Expand All @@ -92,19 +84,7 @@ func (nc *NetConnExtension) WriteMessage(op ws.OpCode, p []byte) error {
}

func (nc *NetConnExtension) NextReader() (ws.Header, io.Reader, error) {
return wsutil.NextReader(nc, ws.StateServerSide)
}

func (nc *NetConnExtension) ReadMessage() (messageType ws.OpCode, p []byte, err error) {
var r io.Reader
var header ws.Header
header, r, err = nc.NextReader()
messageType = header.OpCode
if err != nil {
return messageType, nil, err
}
p, err = io.ReadAll(r)
return messageType, p, err
return wsutil.NextReader(nc, ws.StateClientSide)
}

// ManagedConnection represents a websocket connection.
Expand Down
15 changes: 3 additions & 12 deletions websocket/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ type inspectableConnection struct {
setReadDeadlineCalls chan struct{}
writeMessageCalls chan struct{}
nextReaderCalls chan struct{}
readMessageCalls chan struct{}

readFunc func() (int, error)
writeFunc func() (int, error)
nextReaderFunc func() (ws.Header, io.Reader, error)
readMessageFunc func() (messageType ws.OpCode, p []byte, err error)
readFunc func() (int, error)
writeFunc func() (int, error)
nextReaderFunc func() (ws.Header, io.Reader, error)
}

func (c *inspectableConnection) Close() error {
Expand Down Expand Up @@ -83,13 +81,6 @@ func (c *inspectableConnection) NextReader() (ws.Header, io.Reader, error) {
return c.nextReaderFunc()
}

func (c *inspectableConnection) ReadMessage() (messageType ws.OpCode, p []byte, err error) {
if c.readMessageCalls != nil {
c.readMessageCalls <- struct{}{}
}
return c.readMessageFunc()
}

// staticConnFactory returns a static connection, for example
// an inspectable connection.
func staticConnFactory(conn rawConnection) func() (rawConnection, error) {
Expand Down

0 comments on commit cf65568

Please sign in to comment.