@@ -87,7 +87,7 @@ func dialTinyBufferEcho(port int) (*UDPSession, error) {
87
87
return sess , err
88
88
}
89
89
90
- //////////////////////////
90
+ // ////////////////////////
91
91
func listenEcho (port int ) (net.Listener , error ) {
92
92
//block, _ := NewNoneBlockCrypt(pass)
93
93
//block, _ := NewSimpleXORBlockCrypt(pass)
@@ -575,34 +575,6 @@ func newClosedFlagPacketConn(c net.PacketConn) *closedFlagPacketConn {
575
575
return & closedFlagPacketConn {c , false }
576
576
}
577
577
578
- // Listener should close a net.PacketConn that it created.
579
- // https://github.com/xtaci/kcp-go/issues/165
580
- func TestListenerOwnedPacketConn (t * testing.T ) {
581
- // ListenWithOptions creates its own net.PacketConn.
582
- l , err := ListenWithOptions ("127.0.0.1:0" , nil , 0 , 0 )
583
- if err != nil {
584
- panic (err )
585
- }
586
- defer l .Close ()
587
- // Replace the internal net.PacketConn with one that remembers when it
588
- // has been closed.
589
- pconn := newClosedFlagPacketConn (l .conn )
590
- l .conn = pconn
591
-
592
- if pconn .Closed {
593
- t .Fatal ("owned PacketConn closed before Listener.Close()" )
594
- }
595
-
596
- err = l .Close ()
597
- if err != nil {
598
- panic (err )
599
- }
600
-
601
- if ! pconn .Closed {
602
- t .Fatal ("owned PacketConn not closed after Listener.Close()" )
603
- }
604
- }
605
-
606
578
// Listener should not close a net.PacketConn that it did not create.
607
579
// https://github.com/xtaci/kcp-go/issues/165
608
580
func TestListenerNonOwnedPacketConn (t * testing.T ) {
@@ -635,37 +607,6 @@ func TestListenerNonOwnedPacketConn(t *testing.T) {
635
607
}
636
608
}
637
609
638
- // UDPSession should close a net.PacketConn that it created.
639
- // https://github.com/xtaci/kcp-go/issues/165
640
- func TestUDPSessionOwnedPacketConn (t * testing.T ) {
641
- l := sinkServer (0 )
642
- defer l .Close ()
643
-
644
- // DialWithOptions creates its own net.PacketConn.
645
- client , err := DialWithOptions (l .Addr ().String (), nil , 0 , 0 )
646
- if err != nil {
647
- panic (err )
648
- }
649
- defer client .Close ()
650
- // Replace the internal net.PacketConn with one that remembers when it
651
- // has been closed.
652
- pconn := newClosedFlagPacketConn (client .conn )
653
- client .conn = pconn
654
-
655
- if pconn .Closed {
656
- t .Fatal ("owned PacketConn closed before UDPSession.Close()" )
657
- }
658
-
659
- err = client .Close ()
660
- if err != nil {
661
- panic (err )
662
- }
663
-
664
- if ! pconn .Closed {
665
- t .Fatal ("owned PacketConn not closed after UDPSession.Close()" )
666
- }
667
- }
668
-
669
610
// UDPSession should not close a net.PacketConn that it did not create.
670
611
// https://github.com/xtaci/kcp-go/issues/165
671
612
func TestUDPSessionNonOwnedPacketConn (t * testing.T ) {
0 commit comments