Skip to content

Commit 931f5e5

Browse files
committed
Use different compression when sending gz files over the stream
1 parent ca5d71e commit 931f5e5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/p2p/transfer/directory.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,14 @@ async fn get_compression(path: &Path) -> Result<Compression, Error> {
165165
let mut file = File::open(&path).await?;
166166
file.read_exact(&mut buf).await?;
167167
match buf {
168+
// Zip
168169
[80, 75, 3, 4] => Ok(Compression::Bz),
169-
_ => Ok(DEFAULT_COMPRESSION),
170+
// Gzip
171+
[31, 139, 8, 0] => Ok(Compression::Bz),
172+
v => {
173+
debug!("Compression: {:?}, {:?}", v, path);
174+
Ok(DEFAULT_COMPRESSION)
175+
},
170176
}
171177
}
172178

0 commit comments

Comments
 (0)