Explorar el Código

enable conn reuse settings in mkcp

Darien Raymond hace 9 años
padre
commit
b1f78a1ffc
Se han modificado 2 ficheros con 5 adiciones y 2 borrados
  1. 4 2
      transport/internet/kcp/connection.go
  2. 1 0
      transport/internet/kcp/listener.go

+ 4 - 2
transport/internet/kcp/connection.go

@@ -439,10 +439,12 @@ func (this *Connection) updateTask() {
 }
 
 func (this *Connection) Reusable() bool {
-	return false
+	return this.Config.ConnectionReuse.IsEnabled() && this.reusable
 }
 
-func (this *Connection) SetReusable(b bool) {}
+func (this *Connection) SetReusable(b bool) {
+	this.reusable = b
+}
 
 func (this *Connection) Terminate() {
 	if this == nil {

+ 1 - 0
transport/internet/kcp/listener.go

@@ -100,6 +100,7 @@ func NewListener(address v2net.Address, port v2net.Port, options internet.Listen
 		return nil, err
 	}
 	kcpSettings := networkSettings.(*Config)
+	kcpSettings.ConnectionReuse = &ConnectionReuse{Enable: false}
 
 	auth, err := kcpSettings.GetAuthenticator()
 	if err != nil {