mirror of
https://github.com/XrayR-project/XrayR.git
synced 2025-06-08 05:19:54 +00:00
fix: Try to fix dns memory leak
update: release.yml
This commit is contained in:
parent
40c65a86fc
commit
21e0ebc428
37
.github/workflows/release.yml
vendored
37
.github/workflows/release.yml
vendored
@ -135,17 +135,32 @@ jobs:
|
||||
mv XrayR XrayR.exe
|
||||
|
||||
- name: Prepare to release
|
||||
run: |
|
||||
cp ${GITHUB_WORKSPACE}/README.md ./build_assets/README.md
|
||||
cp ${GITHUB_WORKSPACE}/LICENSE ./build_assets/LICENSE
|
||||
cp ${GITHUB_WORKSPACE}/main/dns.json ./build_assets/dns.json
|
||||
cp ${GITHUB_WORKSPACE}/main/route.json ./build_assets/route.json
|
||||
cp ${GITHUB_WORKSPACE}/main/custom_outbound.json ./build_assets/custom_outbound.json
|
||||
cp ${GITHUB_WORKSPACE}/main/custom_inbound.json ./build_assets/custom_inbound.json
|
||||
cp ${GITHUB_WORKSPACE}/main/rulelist ./build_assets/rulelist
|
||||
cp ${GITHUB_WORKSPACE}/main/config.yml.example ./build_assets/config.yml
|
||||
wget -O ./build_assets/geoip.dat "https://raw.githubusercontent.com/v2fly/geoip/release/geoip.dat"
|
||||
wget -O ./build_assets/geosite.dat "https://raw.githubusercontent.com/v2fly/domain-list-community/release/dlc.dat"
|
||||
uses: nick-fields/retry@v2
|
||||
with:
|
||||
timeout_minutes: 60
|
||||
retry_wait_seconds: 60
|
||||
max_attempts: 5
|
||||
command: |
|
||||
cp ${GITHUB_WORKSPACE}/README.md ./build_assets/README.md
|
||||
cp ${GITHUB_WORKSPACE}/LICENSE ./build_assets/LICENSE
|
||||
cp ${GITHUB_WORKSPACE}/main/dns.json ./build_assets/dns.json
|
||||
cp ${GITHUB_WORKSPACE}/main/route.json ./build_assets/route.json
|
||||
cp ${GITHUB_WORKSPACE}/main/custom_outbound.json ./build_assets/custom_outbound.json
|
||||
cp ${GITHUB_WORKSPACE}/main/custom_inbound.json ./build_assets/custom_inbound.json
|
||||
cp ${GITHUB_WORKSPACE}/main/rulelist ./build_assets/rulelist
|
||||
cp ${GITHUB_WORKSPACE}/main/config.yml.example ./build_assets/config.yml
|
||||
LIST=('geoip geoip geoip' 'domain-list-community dlc geosite')
|
||||
for i in "${LIST[@]}"
|
||||
do
|
||||
INFO=($(echo $i | awk 'BEGIN{FS=" ";OFS=" "} {print $1,$2,$3}'))
|
||||
DOWNLOAD_URL="https://raw.githubusercontent.com/v2fly/${INFO[0]}/release/${INFO[1]}.dat"
|
||||
FILE_NAME="${INFO[2]}.dat"
|
||||
echo -e "Downloading ${DOWNLOAD_URL}..."
|
||||
curl -L "${DOWNLOAD_URL}" -o ./build_assets/${FILE_NAME}
|
||||
echo -e "Verifying HASH key..."
|
||||
HASH="$(curl -sL "${DOWNLOAD_URL}.sha256sum" | awk -F ' ' '{print $1}')"
|
||||
[ "$(sha256sum "./build_assets/${FILE_NAME}" | awk -F ' ' '{print $1}')" == "${HASH}" ] || { echo -e "The HASH key of ${FILE_NAME} does not match cloud one."; exit 1; }
|
||||
done
|
||||
- name: Create ZIP archive
|
||||
shell: bash
|
||||
run: |
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/xtls/xray-core/common/protocol"
|
||||
@ -30,6 +31,7 @@ type LimitInfo struct {
|
||||
}
|
||||
|
||||
type Controller struct {
|
||||
sync.Mutex
|
||||
server *core.Instance
|
||||
config *Config
|
||||
clientInfo api.ClientInfo
|
||||
@ -46,6 +48,7 @@ type Controller struct {
|
||||
stm stats.Manager
|
||||
dispatcher *mydispatcher.DefaultDispatcher
|
||||
startAt time.Time
|
||||
dnsFeature *features.Feature
|
||||
}
|
||||
|
||||
type periodicTask struct {
|
||||
@ -660,8 +663,14 @@ func (c *Controller) addNewDNS(newNodeInfo *api.NodeInfo) error {
|
||||
return err
|
||||
}
|
||||
if feature, ok := obj.(features.Feature); ok {
|
||||
if err := c.server.AddFeature(feature); err != nil {
|
||||
return err
|
||||
// todo fix memory leak
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
if c.dnsFeature == nil {
|
||||
c.dnsFeature = &feature
|
||||
c.server.AddFeature(feature)
|
||||
} else {
|
||||
*c.dnsFeature = feature
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user