diff --git a/README.md b/README.md index 3ba45e6c..48e5c0ac 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ 当任务下载链接失效了,下载没速度或失败则可以使用刷新下载链接的功能,使用新的链接继续下载,具体请[查看](https://github.com/monkeyWie/proxyee-down/blob/master/.guide/common/refresh/read.md)。 ### 百度云破解 #### 2018-03-29更新 -百度云近期对批量下载的并发连接数做了限制,分段数需要建议不要超过64,否则可能会导致任务下载失败或下载速度慢。 +百度云近期对**批量下载**的并发连接数做了限制,分段数需要建议不要超过64,否则可能会导致任务下载失败或下载速度慢。 #### 功能介绍 百度云大文件、合并下载限制突破,成功安装下载器后,打开百度云页面会有如下提示,然后在选择文件后点击下载按钮即可调用proxyee-down下载 ![百度云破解](https://github.com/monkeyWie/proxyee-down/raw/master/.guide/common/bdy-hook.png) diff --git a/common/pom.xml b/common/pom.xml index d76c8d9a..e63c3e48 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ proxyee-down lee.study - 2.43 + 2.44 4.0.0 diff --git a/core/pom.xml b/core/pom.xml index 042d9459..def10798 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -5,7 +5,7 @@ proxyee-down lee.study - 2.43 + 2.44 4.0.0 diff --git a/core/src/main/java/lee/study/down/boot/AbstractHttpDownBootstrap.java b/core/src/main/java/lee/study/down/boot/AbstractHttpDownBootstrap.java index 262bdf5f..393db280 100644 --- a/core/src/main/java/lee/study/down/boot/AbstractHttpDownBootstrap.java +++ b/core/src/main/java/lee/study/down/boot/AbstractHttpDownBootstrap.java @@ -1,9 +1,12 @@ package lee.study.down.boot; import io.netty.bootstrap.Bootstrap; +import io.netty.channel.AdaptiveRecvByteBufAllocator; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; +import io.netty.channel.ChannelOption; +import io.netty.channel.RecvByteBufAllocator; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.handler.codec.http.DefaultLastHttpContent; @@ -40,6 +43,11 @@ public abstract class AbstractHttpDownBootstrap { protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractHttpDownBootstrap.class); + //tcp bufferSize最大为128K + public static final int BUFFER_SIZE = 1024 * 128; + private static final RecvByteBufAllocator RECV_BYTE_BUF_ALLOCATOR = new AdaptiveRecvByteBufAllocator( + 64, BUFFER_SIZE, BUFFER_SIZE); + protected static final String ATTR_CHANNEL = "channel"; protected static final String ATTR_FILE_CLOSEABLE = "fileCloseable"; @@ -95,6 +103,8 @@ protected void startChunkDown(ChunkInfo chunkInfo, int updateStatus) throws Exce LOGGER.debug("开始下载:" + chunkInfo); Bootstrap bootstrap = new Bootstrap() .channel(NioSocketChannel.class) + .option(ChannelOption.RCVBUF_ALLOCATOR, RECV_BYTE_BUF_ALLOCATOR) + .option(ChannelOption.SO_RCVBUF, BUFFER_SIZE) .group(clientLoopGroup) .handler(new HttpDownInitializer(requestProto.getSsl(), this, chunkInfo)); if (httpDownInfo.getProxyConfig() != null) { diff --git a/core/src/main/java/lee/study/down/boot/X86HttpDownBootstrap.java b/core/src/main/java/lee/study/down/boot/X86HttpDownBootstrap.java index c9417ac5..2ff0069a 100644 --- a/core/src/main/java/lee/study/down/boot/X86HttpDownBootstrap.java +++ b/core/src/main/java/lee/study/down/boot/X86HttpDownBootstrap.java @@ -27,13 +27,14 @@ public X86HttpDownBootstrap(HttpDownInfo httpDownInfo, @Override public int doFileWriter(ChunkInfo chunkInfo, ByteBuffer buffer) throws IOException { int ret = buffer.remaining(); + System.out.println(ret); MappedByteBuffer mappedByteBuffer = null; try ( FileChannel fileChannel = new RandomAccessFile( getHttpDownInfo().getTaskInfo().buildTaskFilePath(), "rw").getChannel() ) { mappedByteBuffer = fileChannel - .map(MapMode.READ_WRITE, chunkInfo.getNowStartPosition() + chunkInfo.getDownSize(), ret); + .map(MapMode.READ_WRITE, chunkInfo.getOriStartPosition() + chunkInfo.getDownSize(), ret); mappedByteBuffer.put(buffer); } finally { if (mappedByteBuffer != null) { diff --git a/core/src/main/java/lee/study/down/handle/HttpDownInitializer.java b/core/src/main/java/lee/study/down/handle/HttpDownInitializer.java index 6016f189..7af63c17 100644 --- a/core/src/main/java/lee/study/down/handle/HttpDownInitializer.java +++ b/core/src/main/java/lee/study/down/handle/HttpDownInitializer.java @@ -52,7 +52,8 @@ protected void initChannel(Channel ch) throws Exception { ch.pipeline().addLast(bootstrap.getClientSslContext().newHandler(ch.alloc())); } ch.pipeline() - .addLast("httpCodec", new HttpClientCodec()); + .addLast("httpCodec", + new HttpClientCodec(4096, 8192, AbstractHttpDownBootstrap.BUFFER_SIZE)); ch.pipeline().addLast(new ChannelInboundHandlerAdapter() { private Closeable closeable; @@ -130,7 +131,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception Integer responseCode = httpResponse.status().code(); if (responseCode.toString().indexOf("20") != 0) { //应对百度近期同一时段多个连接返回400的问题 - LOGGER.debug( + LOGGER.warn( "响应状态码异常:" + responseCode + "\t" + chunkInfo); if (responseCode == 401 || responseCode == 403 || responseCode == 404) { chunkInfo.setStatus(HttpDownStatus.ERROR_WAIT_CONNECT); diff --git a/pom.xml b/pom.xml index cda10f0e..3d2405f5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 lee.study proxyee-down - 2.43 + 2.44 pom diff --git a/sniff/pom.xml b/sniff/pom.xml index 99f5363a..7ba45d37 100644 --- a/sniff/pom.xml +++ b/sniff/pom.xml @@ -5,7 +5,7 @@ proxyee-down lee.study - 2.43 + 2.44 4.0.0 diff --git a/ui/pom.xml b/ui/pom.xml index a1e40738..3fdbc9b5 100644 --- a/ui/pom.xml +++ b/ui/pom.xml @@ -5,7 +5,7 @@ proxyee-down lee.study - 2.43 + 2.44 4.0.0 diff --git a/ui/src/main/resources/application.properties b/ui/src/main/resources/application.properties index faa95433..c661a8be 100644 --- a/ui/src/main/resources/application.properties +++ b/ui/src/main/resources/application.properties @@ -1,4 +1,4 @@ -app.version=2.43 +app.version=2.44 spring.profiles.active=prd view.server.port = 8999 tomcat.server.port = 26339 diff --git a/ui/src/main/resources/logback-prd.xml b/ui/src/main/resources/logback-prd.xml index 62ab3068..848a0bb5 100644 --- a/ui/src/main/resources/logback-prd.xml +++ b/ui/src/main/resources/logback-prd.xml @@ -14,4 +14,6 @@ + + \ No newline at end of file diff --git a/ui/view/src/components/ConfigPage.vue b/ui/view/src/components/ConfigPage.vue index 3aea812f..f44a7d67 100644 --- a/ui/view/src/components/ConfigPage.vue +++ b/ui/view/src/components/ConfigPage.vue @@ -10,7 +10,7 @@ diff --git a/ui/view/src/components/NewTask.vue b/ui/view/src/components/NewTask.vue index 9c6ac421..1f7854f4 100644 --- a/ui/view/src/components/NewTask.vue +++ b/ui/view/src/components/NewTask.vue @@ -27,7 +27,7 @@ diff --git a/ui/view/src/components/TaskList.vue b/ui/view/src/components/TaskList.vue index e2778aca..90189c6a 100644 --- a/ui/view/src/components/TaskList.vue +++ b/ui/view/src/components/TaskList.vue @@ -237,12 +237,12 @@ switch (task.status) { case 7: return 'success'; - case 2: case 6: return 'exception'; case 5: return 'pause'; case 1: + case 2: case 8: return 'ready'; default: diff --git a/update/pom.xml b/update/pom.xml index 9c7902ae..d3f92d76 100644 --- a/update/pom.xml +++ b/update/pom.xml @@ -7,7 +7,7 @@ lee.study proxyee-down-update jar - 2.43 + 2.44 UTF-8