Skip to content

Commit 62c88ae

Browse files
author
wangzihao
committed
修复bug:http同时上传10个10M以上的文件,会导致接口卡住
1 parent 25c203b commit 62c88ae

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ github地址 : https://github.com/wangzihaogithub/spring-boot-protocol
149149
<dependency>
150150
<groupId>com.github.wangzihaogithub</groupId>
151151
<artifactId>spring-boot-protocol</artifactId>
152-
<version>2.3.20</version>
152+
<version>2.3.21</version>
153153
</dependency>
154154
```
155155

@@ -161,7 +161,7 @@ github地址 : https://github.com/wangzihaogithub/spring-boot-protocol
161161
<dependency>
162162
<groupId>com.github.wangzihaogithub</groupId>
163163
<artifactId>netty-servlet</artifactId>
164-
<version>2.3.20</version>
164+
<version>2.3.21</version>
165165
</dependency>
166166
```
167167

@@ -317,7 +317,7 @@ github地址 : https://github.com/wangzihaogithub/spring-boot-protocol
317317
<dependency>
318318
<groupId>com.github.wangzihaogithub</groupId>
319319
<artifactId>spring-boot-protocol</artifactId>
320-
<version>2.3.20</version>
320+
<version>2.3.21</version>
321321
</dependency>
322322

323323
2.编写代码
@@ -397,7 +397,7 @@ github地址 : https://github.com/wangzihaogithub/spring-boot-protocol
397397
<dependency>
398398
<groupId>com.github.wangzihaogithub</groupId>
399399
<artifactId>spring-boot-protocol</artifactId>
400-
<version>2.3.20</version>
400+
<version>2.3.21</version>
401401
</dependency>
402402

403403
2.编写代码
@@ -486,7 +486,7 @@ github地址 : https://github.com/wangzihaogithub/spring-boot-protocol
486486
<dependency>
487487
<groupId>com.github.wangzihaogithub</groupId>
488488
<artifactId>spring-boot-protocol</artifactId>
489-
<version>2.3.20</version>
489+
<version>2.3.21</version>
490490
</dependency>
491491
492492
2.编写启动类

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.github.wangzihaogithub</groupId>
66
<artifactId>spring-boot-protocol</artifactId>
7-
<version>2.3.20</version>
7+
<version>2.3.21</version>
88
<packaging>jar</packaging>
99

1010
<name>Spring Boot Protocol</name>
@@ -49,7 +49,7 @@
4949
<connection>scm:git:https://github.com/wangzihaogithub/spring-boot-protocol.git</connection>
5050
<developerConnection>scm:git:[email protected]:wangzihaogithub/spring-boot-protocol.git</developerConnection>
5151
<url>[email protected]:wangzihaogithub/spring-boot-protocol.git</url>
52-
<tag>v2.3.20</tag>
52+
<tag>v2.3.21</tag>
5353
</scm>
5454

5555
<!-- 开发者信息 -->

src/main/java/com/github/netty/protocol/servlet/ServletInputStreamWrapper.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ void onMessage(HttpContent httpContent) {
115115
} finally {
116116
if (httpContent instanceof LastHttpContent) {
117117
this.receivedLastHttpContent = true;
118+
conditionSignalAll();
118119
}
119120
}
120121
}
@@ -201,12 +202,7 @@ private void onMessage0(HttpContent httpContent) {
201202
}
202203
}
203204

204-
lock.lock();
205-
try {
206-
condition.signalAll();
207-
} finally {
208-
lock.unlock();
209-
}
205+
conditionSignalAll();
210206

211207
boolean received = isReceived();
212208
SeekableByteChannel uploadFileOutputChannel = this.uploadFileOutputChannel;
@@ -233,6 +229,15 @@ private void onMessage0(HttpContent httpContent) {
233229
}
234230
}
235231

232+
private void conditionSignalAll() {
233+
lock.lock();
234+
try {
235+
condition.signalAll();
236+
} finally {
237+
lock.unlock();
238+
}
239+
}
240+
236241
private void addReaderIndex(long readableBytes) {
237242
if (readableBytes > 0) {
238243
if (readerIndex.addAndGet(readableBytes) >= contentLength && onAllDataReadFlag.compareAndSet(false, true)) {

src/main/resources/server.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
server.info=Github Spring-boot-protocol/2.3.20
17-
server.number=2.3.20
18-
server.built=Jun 26 2024 10:54:21 UTC+8
16+
server.info=Github Spring-boot-protocol/2.3.21
17+
server.number=2.3.21
18+
server.built=Jul 26 2024 13:41:32 UTC+8

0 commit comments

Comments
 (0)