File tree 4 files changed +6
-10
lines changed
4 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ import (
17
17
"github.com/smallnest/rpcx/log"
18
18
"github.com/smallnest/rpcx/protocol"
19
19
"github.com/smallnest/rpcx/share"
20
- "github.com/smallnest/rpcx/util"
21
20
)
22
21
23
22
const (
@@ -530,13 +529,6 @@ func (client *Client) input() {
530
529
} else {
531
530
data := res .Payload
532
531
if len (data ) > 0 {
533
- if res .CompressType () == protocol .Gzip {
534
- data , err = util .Unzip (data )
535
- if err != nil {
536
- call .Error = ServiceError ("unzip payload: " + err .Error ())
537
- }
538
- }
539
-
540
532
codec := share .Codecs [res .SerializeType ()]
541
533
if codec == nil {
542
534
call .Error = ServiceError (ErrUnsupportedCodec .Error ())
Original file line number Diff line number Diff line change 1
1
package protocol
2
2
3
- import "github.com/smallnest/rpcx/util"
3
+ import (
4
+ "github.com/smallnest/rpcx/util"
5
+ )
4
6
5
7
// Compressor defines a common compression interface.
6
8
type Compressor interface {
Original file line number Diff line number Diff line change @@ -234,7 +234,6 @@ func (m Message) Encode() []byte {
234
234
payload = m .Payload
235
235
}
236
236
}
237
-
238
237
}
239
238
240
239
totalL := (4 + spL ) + (4 + smL ) + (4 + len (meta )) + (4 + len (payload ))
Original file line number Diff line number Diff line change @@ -366,6 +366,9 @@ func (s *Server) serveConn(conn net.Conn) {
366
366
}
367
367
}
368
368
369
+ if len (res .Payload ) > 1024 && req .CompressType () != protocol .None {
370
+ res .SetCompressType (req .CompressType ())
371
+ }
369
372
data := res .Encode ()
370
373
conn .Write (data )
371
374
//res.WriteTo(conn)
You can’t perform that action at this time.
0 commit comments