Forráskód Böngészése

Remove compression

Jakob Borg 11 éve
szülő
commit
39a691a7e6
3 módosított fájl, 12 hozzáadás és 29 törlés
  1. 3 0
      cmd/syncthing/main.go
  2. 1 8
      protocol/PROTOCOL.md
  3. 8 21
      protocol/protocol.go

+ 3 - 0
cmd/syncthing/main.go

@@ -735,6 +735,9 @@ next:
 				protoConn := protocol.NewConnection(remoteID, conn, wr, m)
 
 				l.Infof("Established secure connection to %s at %v", remoteID, conn.RemoteAddr())
+				if debugNet {
+					l.Debugf("cipher suite %04X", conn.ConnectionState().CipherSuite)
+				}
 				events.Default.Log(events.NodeConnected, map[string]string{
 					"id":   remoteID.String(),
 					"addr": conn.RemoteAddr().String(),

+ 1 - 8
protocol/PROTOCOL.md

@@ -25,24 +25,17 @@ Transport and Authentication
 ----------------------------
 
 BEP is deployed as the highest level in a protocol stack, with the lower
-level protocols providing compression, encryption and authentication.
+level protocols providing encryption and authentication.
 
     +-----------------------------|
     |   Block Exchange Protocol   |
     |-----------------------------|
-    |   Compression (RFC 1951)    |
-    |-----------------------------|
     | Encryption & Auth (TLS 1.2) |
     |-----------------------------|
     |             TCP             |
     |-----------------------------|
     v             ...             v
 
-Compression is started directly after a successful TLS handshake,
-before the first message is sent. The compression is flushed at each
-message boundary. Compression SHALL use the DEFLATE format as specified
-in RFC 1951.
-
 The encryption and authentication layer SHALL use TLS 1.2 or a higher
 revision. A strong cipher suite SHALL be used, with "strong cipher
 suite" being defined as being without known weaknesses and providing

+ 8 - 21
protocol/protocol.go

@@ -6,7 +6,6 @@ package protocol
 
 import (
 	"bufio"
-	"compress/flate"
 	"errors"
 	"fmt"
 	"io"
@@ -78,14 +77,12 @@ type rawConnection struct {
 	receiver Model
 	state    int
 
-	reader io.ReadCloser
-	cr     *countingReader
-	xr     *xdr.Reader
+	cr *countingReader
+	xr *xdr.Reader
 
-	writer io.WriteCloser
-	cw     *countingWriter
-	wb     *bufio.Writer
-	xw     *xdr.Writer
+	cw *countingWriter
+	wb *bufio.Writer
+	xw *xdr.Writer
 
 	awaiting    []chan asyncResult
 	awaitingMut sync.Mutex
@@ -113,21 +110,15 @@ func NewConnection(nodeID NodeID, reader io.Reader, writer io.Writer, receiver M
 	cr := &countingReader{Reader: reader}
 	cw := &countingWriter{Writer: writer}
 
-	flrd := flate.NewReader(cr)
-	flwr, err := flate.NewWriter(cw, flate.BestSpeed)
-	if err != nil {
-		panic(err)
-	}
-	wb := bufio.NewWriter(flwr)
+	rb := bufio.NewReader(cr)
+	wb := bufio.NewWriter(cw)
 
 	c := rawConnection{
 		id:       nodeID,
 		receiver: nativeModel{receiver},
 		state:    stateInitial,
-		reader:   flrd,
 		cr:       cr,
-		xr:       xdr.NewReader(flrd),
-		writer:   flwr,
+		xr:       xdr.NewReader(rb),
 		cw:       cw,
 		wb:       wb,
 		xw:       xdr.NewWriter(wb),
@@ -485,10 +476,6 @@ func (c *rawConnection) flush() error {
 		return err
 	}
 
-	if f, ok := c.writer.(flusher); ok {
-		return f.Flush()
-	}
-
 	return nil
 }