mirror of
https://github.com/c0re100/gotdlib.git
synced 2026-02-21 20:20:17 +01:00
Merge upstream fix
This commit is contained in:
parent
626ffe1a7b
commit
2a5a6d2b76
1 changed files with 8 additions and 8 deletions
|
|
@ -86,15 +86,15 @@ func NewClient(authorizationStateHandler AuthorizationStateHandler, options ...O
|
||||||
client.extraGenerator = UuidV4Generator()
|
client.extraGenerator = UuidV4Generator()
|
||||||
client.catchTimeout = 60 * time.Second
|
client.catchTimeout = 60 * time.Second
|
||||||
|
|
||||||
for _, option := range options {
|
|
||||||
option(client)
|
|
||||||
}
|
|
||||||
|
|
||||||
tdlibInstance.addClient(client)
|
tdlibInstance.addClient(client)
|
||||||
|
|
||||||
go client.processPendingResponse()
|
go client.processPendingResponse()
|
||||||
go client.receiver()
|
go client.receiver()
|
||||||
|
|
||||||
|
for _, option := range options {
|
||||||
|
go option(client)
|
||||||
|
}
|
||||||
|
|
||||||
err := Authorize(client, authorizationStateHandler)
|
err := Authorize(client, authorizationStateHandler)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -155,6 +155,10 @@ func (client *Client) processResponse(response *Response) {
|
||||||
if needGc {
|
if needGc {
|
||||||
client.listenerStore.gc()
|
client.listenerStore.gc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if typ.GetType() == TypeUpdateAuthorizationState && typ.(*UpdateAuthorizationState).AuthorizationState.AuthorizationStateType() == TypeAuthorizationStateClosed {
|
||||||
|
close(client.responses)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) receiver() {
|
func (client *Client) receiver() {
|
||||||
|
|
@ -257,7 +261,3 @@ func (client *Client) AddEventReceiver(msgType Type, channelCapacity int) *Liste
|
||||||
|
|
||||||
return listener
|
return listener
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) Stop() {
|
|
||||||
client.Destroy()
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue