libnmdc: reinstate backward-compatibility re new sync api
This commit is contained in:
parent
019f67a7de
commit
73f6d66cbd
@ -87,7 +87,6 @@ type HubConnectionOptions struct {
|
|||||||
|
|
||||||
// Returning messages in async mode
|
// Returning messages in async mode
|
||||||
NumEventsToBuffer uint
|
NumEventsToBuffer uint
|
||||||
OnEvent chan HubEvent
|
|
||||||
|
|
||||||
// Returning messages in sync mode
|
// Returning messages in sync mode
|
||||||
OnEventSync func(HubEvent)
|
OnEventSync func(HubEvent)
|
||||||
@ -104,6 +103,7 @@ type HubConnection struct {
|
|||||||
|
|
||||||
// Streamed events
|
// Streamed events
|
||||||
processEvent func(HubEvent)
|
processEvent func(HubEvent)
|
||||||
|
OnEvent chan HubEvent
|
||||||
|
|
||||||
// Private state
|
// Private state
|
||||||
conn net.Conn // this is an interface
|
conn net.Conn // this is an interface
|
||||||
@ -428,14 +428,11 @@ func (this *HubConnectionOptions) Connect() *HubConnection {
|
|||||||
if this.NumEventsToBuffer < 1 {
|
if this.NumEventsToBuffer < 1 {
|
||||||
this.NumEventsToBuffer = 1
|
this.NumEventsToBuffer = 1
|
||||||
}
|
}
|
||||||
if this.OnEvent == nil {
|
|
||||||
this.OnEvent = make(chan HubEvent, this.NumEventsToBuffer)
|
|
||||||
}
|
|
||||||
|
|
||||||
hc := this.prepareConnection()
|
hc := this.prepareConnection()
|
||||||
|
hc.OnEvent = make(chan HubEvent, this.NumEventsToBuffer)
|
||||||
hc.processEvent = func(ev HubEvent) {
|
hc.processEvent = func(ev HubEvent) {
|
||||||
this.OnEvent <- ev
|
hc.OnEvent <- ev
|
||||||
}
|
}
|
||||||
|
|
||||||
go hc.worker()
|
go hc.worker()
|
||||||
|
Loading…
Reference in New Issue
Block a user