ossrs / srs

SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.

Home Page:https://ossrs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SRS3.0 origin_cluster with multiple coworkers doesn't work

rageJune opened this issue · comments

when merging the code of fix#464 on SRS3.0, origin_cluster with multiple coworkers doesn't work.
when multiple coworkers, in the loop it tries the first coworker and if not active origin, it breaks.

if (!info->edge && _srs_config->get_vhost_origin_cluster(req->vhost) && source->inactive()) {
    vector<string> coworkers = _srs_config->get_vhost_coworkers(req->vhost);
    for (int i = 0; i < (int)coworkers.size(); i++) {
        int port;
        string host;
        string url = "http://" + coworkers.at(i) + "/api/v1/clusters?"
            + "vhost=" + req->vhost + "&ip=" + req->host + "&app=" + req->app + "&stream=" + req->stream;
        if ((err = SrsHttpHooks::discover_co_workers(url, host, port)) != srs_success) {
            return srs_error_wrap(err, "discover coworkers, url=%s", url.c_str());
        }

// when the coworker didn't work, it returns, never try other coworkers.
// should be continue??

Dup to #1520