File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ func (s *ssService) HandleAssociation(conn net.Conn) error {
148148 if err != nil {
149149 return fmt .Errorf ("failed to handle association: %v" , err )
150150 }
151- HandleAssociation (conn , assoc )
151+ HandleAssociation (assoc )
152152 return nil
153153}
154154
Original file line number Diff line number Diff line change @@ -355,11 +355,11 @@ func (m *natmap) Close() error {
355355 return err
356356}
357357
358- func HandleAssociation (conn net. Conn , assoc PacketAssociation ) {
358+ func HandleAssociation (assoc PacketAssociation ) {
359359 for {
360360 lazySlice := readBufPool .LazySlice ()
361361 buf := lazySlice .Acquire ()
362- n , err := conn .Read (buf )
362+ n , err := assoc .Read (buf )
363363 if errors .Is (err , net .ErrClosed ) {
364364 lazySlice .Release ()
365365 return
@@ -384,9 +384,13 @@ type PacketAssociation interface {
384384 // released after the packet is processed.
385385 HandlePacket (pkt []byte , lazySlice slicepool.LazySlice )
386386
387+ // Read reads data from the association.
388+ Read (b []byte ) (n int , err error )
389+
387390 // Done returns a channel that is closed when the association is closed.
388391 Done () <- chan struct {}
389392
393+
390394 // Close closes the association and releases any associated resources.
391395 Close () error
392396}
You can’t perform that action at this time.
0 commit comments