Skip to content

Commit 7bd656c

Browse files
committed
*update Dockerfile *add more read timeout set point
1 parent 77e0f36 commit 7bd656c

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

Dockerfile

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM golang:1.20-bullseye
15+
FROM golang:1.20-bookworm
1616

17-
# apt 切换国内源,安装 google webrtc 依赖安装脚本的依赖
18-
# mirrors.163.com
19-
# repo.huaweicloud.com
20-
RUN sed -i 's|deb.debian.org|mirrors.163.com|g' /etc/apt/sources.list && \
21-
apt update && \
17+
RUN apt update && \
2218
apt install xz-utils bzip2 sudo lsb-release ninja-build generate-ninja file patch -y
2319

2420
# 安装nodejs 20
@@ -31,12 +27,7 @@ RUN apt-get install -y ca-certificates curl gnupg && \
3127
apt-get install nodejs -y
3228

3329
# 安装msquic依赖
34-
RUN apt-get update && \
35-
apt-get install -y cmake build-essential liblttng-ust-dev lttng-tools libssl-dev && \
36-
wget https://cmake.org/files/v3.23/cmake-3.23.0.tar.gz && \
37-
tar -zxvf cmake-3.23.0.tar.gz && cd cmake-3.23.0 && ./configure && make -j8 && make install && \
38-
cmake --version
39-
# RUN apt-get install -y cmake build-essential liblttng-ust-dev lttng-tools
30+
RUN apt-get install -y cmake build-essential liblttng-ust-dev lttng-tools libssl-dev
4031

4132
# golang 切换国内源并且提前安装好依赖
4233
ENV GO111MODULE=on
@@ -47,16 +38,12 @@ RUN cd /go/src/github.com/isrc-cas/gt && \
4738
rm -rf /go/src/github.com/isrc-cas/gt
4839

4940
# 安装 gnu 编译链
50-
RUN apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-x86-64-linux-gnu g++-x86-64-linux-gnu -y
41+
RUN apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-x86-64-linux-gnu g++-x86-64-linux-gnu
5142

5243
# 安装 google webrtc 依赖
5344
ADD ./dep/_google-webrtc/src/build /root/build
5445
RUN sed -i 's/egrep -q "i686|x86_64"/true/g' /root/build/install-build-deps.sh && \
5546
DEBIAN_FRONTEND=noninteractive TZ=Asia/Shanghai bash /root/build/install-build-deps.sh --no-chromeos-fonts && \
5647
rm -rf /root/build
5748

58-
RUN if uname -m | grep aarch64; then \
59-
file /usr/x86_64-linux-gnu/lib/libm.a | grep "ASCII text" && \
60-
rm -f /usr/x86_64-linux-gnu/lib/libm.a && \
61-
ln -s /usr/x86_64-linux-gnu/lib/libm-2.31.a /usr/x86_64-linux-gnu/lib/libm.a && echo "success"; \
62-
fi
49+
RUN cp -r /usr/x86_64-linux-gnu/lib/* /usr/lib/x86_64-linux-gnu/

server/conn.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,12 @@ func (c *conn) process(taskID uint32, task *conn, cli *client) {
962962
buf[4] = byte(predef.Close >> 8)
963963
buf[5] = byte(predef.Close)
964964
_, wErr = c.Write(buf[:6])
965+
if wErr == nil &&
966+
c.server.config.Timeout.Duration > 0 &&
967+
!c.server.config.TimeoutOnUnidirectionalTraffic {
968+
dl := time.Now().Add(c.server.config.Timeout.Duration)
969+
wErr = c.SetReadDeadline(dl)
970+
}
965971
}
966972
pool.BytesPool.Put(buf)
967973
if rErr != nil || wErr != nil {
@@ -1011,6 +1017,13 @@ func (c *conn) process(taskID uint32, task *conn, cli *client) {
10111017
if wErr != nil {
10121018
return
10131019
}
1020+
if c.server.config.Timeout.Duration > 0 && !c.server.config.TimeoutOnUnidirectionalTraffic {
1021+
dl := time.Now().Add(c.server.config.Timeout.Duration)
1022+
wErr = c.SetReadDeadline(dl)
1023+
if wErr != nil {
1024+
return
1025+
}
1026+
}
10141027

10151028
bufIndex -= 4
10161029
buf[bufIndex] = byte(predef.Data >> 8)

0 commit comments

Comments
 (0)