添加更新用户流量的方法,并定时跟新到所有用户
Change-Id: I9aa5b3ace0bf327980554a89611b059caed12360
diff --git a/src/main/java/com/pt/service/TorrentService.java b/src/main/java/com/pt/service/TorrentService.java
index 1fdb700..ad38622 100644
--- a/src/main/java/com/pt/service/TorrentService.java
+++ b/src/main/java/com/pt/service/TorrentService.java
@@ -18,6 +18,10 @@
private TorrentMetaRepository torrentMetaRepository;
public TorrentMeta parseAndSaveTorrent(byte[] torrentBytes) throws Exception {
+ System.out.println("111");
+ for (byte b : torrentBytes) {
+ System.out.println(b);
+ }
Map<String, Object> torrentDict = (Map<String, Object>) BencodeCodec.decode(torrentBytes);
if (!torrentDict.containsKey("info")) {
throw new IllegalArgumentException("Invalid torrent file: missing 'info' dictionary");
@@ -25,12 +29,14 @@
Map<String, Object> infoDict = (Map<String, Object>) torrentDict.get("info");
+ System.out.println(222);
// 计算 info_hash
byte[] infoEncoded = BencodeCodec.encode(infoDict);
MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
byte[] infoHashBytes = sha1.digest(infoEncoded);
String infoHash = bytesToHex(infoHashBytes);
+ System.out.println(333);
// 获取文件名,大小等
String name = (String) infoDict.get("name");
long length = 0;