Skip to content

Commit

Permalink
SmartPtr: Fix bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jun 11, 2024
1 parent ea3b366 commit 596c8c3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
25 changes: 17 additions & 8 deletions trunk/src/app/srs_app_gb28181.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,14 +909,7 @@ srs_error_t SrsGbSipTcpConn::cycle()
}

// Wait for the SIP connection to be terminated.
while (true) {
if (!owner_coroutine_) return err;
if ((err = owner_coroutine_->pull()) != srs_success) {
return srs_error_wrap(err, "pull");
}

srs_usleep(SRS_UTIME_NO_TIMEOUT);
}
err = do_cycle();

// Interrupt the receiver and sender coroutine.
receiver_->interrupt();
Expand Down Expand Up @@ -949,6 +942,22 @@ srs_error_t SrsGbSipTcpConn::cycle()
return srs_success;
}

srs_error_t SrsGbSipTcpConn::do_cycle()
{
srs_error_t err = srs_success;

while (true) {
if (!owner_coroutine_) return err;
if ((err = owner_coroutine_->pull()) != srs_success) {
return srs_error_wrap(err, "pull");
}

srs_usleep(SRS_UTIME_NO_TIMEOUT);
}

return err;
}

srs_error_t SrsGbSipTcpConn::bind_session(SrsSipMessage* msg, SrsGbSession** psession)
{
srs_error_t err = srs_success;
Expand Down
2 changes: 2 additions & 0 deletions trunk/src/app/srs_app_gb28181.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ class SrsGbSipTcpConn : public ISrsResource, public ISrsCoroutineHandler, public
// Interface ISrsOneCycleThreadHandler
public:
virtual srs_error_t cycle();
private:
srs_error_t do_cycle();
private:
// Create session if no one, or bind to an existed session.
srs_error_t bind_session(SrsSipMessage* msg, SrsGbSession** psession);
Expand Down

0 comments on commit 596c8c3

Please sign in to comment.