Skip to content

Commit fe38804

Browse files
authored
Incorrect use of two "int i" instances. (#3759)
1 parent 73dd8af commit fe38804

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

trunk/3rdparty/srs-bench/pcap/main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,14 @@ func doMain(ctx context.Context) error {
108108
}
109109

110110
if doRE {
111-
if previousTime != nil {
112-
if diff := ci.Timestamp.Sub(*previousTime); diff > 0 {
111+
if previousTime == nil {
112+
previousTime = &ci.Timestamp
113+
} else {
114+
if diff := ci.Timestamp.Sub(*previousTime); diff > 100*time.Millisecond {
113115
time.Sleep(diff)
116+
previousTime = &ci.Timestamp
114117
}
115118
}
116-
previousTime = &ci.Timestamp
117119
}
118120

119121
if doTrace {

trunk/src/app/srs_app_threads.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,8 @@ srs_error_t SrsThreadPool::run()
693693
// Check the threads status fastly.
694694
int loops = (int)(interval_ / SRS_UTIME_SECONDS);
695695
for (int i = 0; i < loops; i++) {
696-
for (int i = 0; i < (int)threads.size(); i++) {
697-
SrsThreadEntry* entry = threads.at(i);
696+
for (int j = 0; j < (int)threads.size(); j++) {
697+
SrsThreadEntry* entry = threads.at(j);
698698
if (entry->err != srs_success) {
699699
// Quit with success.
700700
if (srs_error_code(entry->err) == ERROR_THREAD_FINISHED) {

0 commit comments

Comments
 (0)