mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
📝 内核参数增加 --port https://github.com/siyuan-note/siyuan/issues/6344
This commit is contained in:
parent
fc4db17217
commit
a20a19182b
4 changed files with 7 additions and 76 deletions
|
|
@ -24,7 +24,6 @@ import (
|
|||
"github.com/88250/gulu"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/olahol/melody"
|
||||
"github.com/siyuan-note/logging"
|
||||
)
|
||||
|
||||
func GetRemoteAddr(session *melody.Session) string {
|
||||
|
|
@ -64,22 +63,3 @@ func isPortOpen(port string) bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func tryToListenPort() bool {
|
||||
listener, err := net.Listen("tcp", "127.0.0.1:"+ServerPort)
|
||||
if nil != err {
|
||||
time.Sleep(time.Second * 3)
|
||||
listener, err = net.Listen("tcp", "127.0.0.1:"+ServerPort)
|
||||
if nil != err {
|
||||
logging.LogErrorf("try to listen port [%s] failed: %s", ServerPort, err)
|
||||
return false
|
||||
}
|
||||
}
|
||||
if err = listener.Close(); nil != err {
|
||||
time.Sleep(time.Second * 1)
|
||||
if err = listener.Close(); nil != err {
|
||||
logging.LogErrorf("close listen port [%s] failed: %s", ServerPort, err)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue