Browse Source

Merge pull request #22 from pwli0755/fix-flow-handler

fix startNotifyFlowHandler (issue #13)
pull/31/head
Lane Wagner 5 years ago
committed by GitHub
parent
commit
d614bb372e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      publish.go

+ 6
- 4
publish.go View File

@ -225,15 +225,17 @@ func (publisher Publisher) StopPublishing() {
}
func (publisher *Publisher) startNotifyFlowHandler() {
// Listeners for active=true flow control. When true is sent to a listener,
// publishing should pause until false is sent to listeners.
for ok := range publisher.notifyFlowChan {
publisher.disablePublishDueToFlowMux.Lock()
publisher.logger.Printf("pausing publishing due to flow request from server")
if ok {
publisher.disablePublishDueToFlow = false
} else {
publisher.logger.Printf("pausing publishing due to flow request from server")
publisher.disablePublishDueToFlow = true
} else {
publisher.disablePublishDueToFlow = false
publisher.logger.Printf("resuming publishing due to flow request from server")
}
publisher.disablePublishDueToFlowMux.Unlock()
publisher.logger.Printf("resuming publishing due to flow request from server")
}
}

Loading…
Cancel
Save