Skip to content

Commit 8c73680

Browse files
committed
clientcore: implement net.PacketConn for BroflakeConn
Instead of embedding net.PacketConn in BroflakeConn, implement net.PacketConn so we have full control.
1 parent 3d38ce2 commit 8c73680

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clientcore/user.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
)
2121

2222
type BroflakeConn struct {
23-
net.PacketConn
2423
writeChan chan IPCMsg
2524
readChan chan IPCMsg
2625
localAddr common.DebugAddr
@@ -97,6 +96,9 @@ func (c *BroflakeConn) SetReadDeadline(t time.Time) error {
9796
return nil
9897
}
9998

99+
func (c *BroflakeConn) SetWriteDeadline(t time.Time) error { return nil }
100+
func (c *BroflakeConn) SetDeadline(t time.Time) error { return c.SetReadDeadline(t) }
101+
100102
func (c *BroflakeConn) Close() error {
101103
c.closeOnce.Do(func() {
102104
close(c.writeChan)
@@ -119,7 +121,6 @@ func NewProducerUserStream(wg *sync.WaitGroup) (*BroflakeConn, *WorkerFSM) {
119121
})
120122

121123
bfconn := BroflakeConn{
122-
PacketConn: &net.UDPConn{},
123124
writeChan: worker.com.tx,
124125
readChan: worker.com.rx,
125126
localAddr: common.DebugAddr(uuid.NewString()),
@@ -148,7 +149,6 @@ func NewConsumerUserStream(wg *sync.WaitGroup) (*BroflakeConn, *WorkerFSM) {
148149
})
149150

150151
bfconn := BroflakeConn{
151-
PacketConn: &net.UDPConn{},
152152
writeChan: worker.com.tx,
153153
readChan: worker.com.rx,
154154
localAddr: common.DebugAddr(uuid.NewString()),

0 commit comments

Comments
 (0)