Frp: During startup, can frpc retry if error on server connection?

Created on 17 Feb 2017  ·  8Comments  ·  Source: fatedier/frp

The case happens when I start frps later than frpc.
frpc will try to connect server, but the frps is not running yet. So frpc print "connect to server failed!" then exit.
Refer to code in frpc/control.go func ControlProcess(cli *client.ProxyClient, wait *sync.WaitGroup)

    c, err := loginToServer(cli)
    if err != nil {
        log.Error("ProxyName [%s], connect to server failed!", cli.Name)
        return
    }

Would it be better to have a while loop here? always retry until connected to server (also wait (e.g. 10s) between each retry)

Most helpful comment

If you're using systemd to launch frps, add something like this in the systemd conf file:

[Service]
Restart=on-failure    
RestartSec=5s

A hint for someone like me newly to the frps and systemd.

All 8 comments

请讲普通话

@yydcool Users may set wrong server ip or port, and it will never connect success. So i think it's better to feedback the error and exit.

@cxx8294 Github 上推荐用英语,方便各个国家的使用者共同交流,只要别人能看懂就行了。

但是有时候需要重启公网的frps来重新加载配置文件,如果不自动重连的话那就很麻烦了,希望在启动参数中加入失败重试。

建议新加参数,让用户承担后果吧~
当前的情况是,FRPS似乎因为内存的问题导致服务器崩了,重启了服务器之后,人不在FRPC的环境没办法远程遥控FRPC重启,就造成了一个连不上FRPS的死局···

If you're using systemd to launch frps, add something like this in the systemd conf file:

[Service]
Restart=on-failure    
RestartSec=5s

A hint for someone like me newly to the frps and systemd.

A configurable retry entry is helpful for embedding devices, because their network service such as 4G may not be stable.

If you're using systemd to launch frps, add something like this in the systemd conf file:

[Service]
Restart=on-failure    
RestartSec=5s

A hint for someone like me newly to the frps and systemd.

Thanks a lot. This method works well. It will retry every "RestartSec“.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AngryBaby picture AngryBaby  ·  3Comments

mbj2014 picture mbj2014  ·  3Comments

wztx picture wztx  ·  3Comments

n0trace picture n0trace  ·  3Comments

guodong1994 picture guodong1994  ·  4Comments