Merge upstream fix

This commit is contained in:
c0re100 2025-01-03 06:16:40 +08:00
parent 626ffe1a7b
commit 2a5a6d2b76
No known key found for this signature in database
GPG key ID: 7C3B3004FE745AAF

View file

@ -86,15 +86,15 @@ func NewClient(authorizationStateHandler AuthorizationStateHandler, options ...O
client.extraGenerator = UuidV4Generator()
client.catchTimeout = 60 * time.Second
for _, option := range options {
option(client)
}
tdlibInstance.addClient(client)
go client.processPendingResponse()
go client.receiver()
for _, option := range options {
go option(client)
}
err := Authorize(client, authorizationStateHandler)
if err != nil {
return nil, err
@ -155,6 +155,10 @@ func (client *Client) processResponse(response *Response) {
if needGc {
client.listenerStore.gc()
}
if typ.GetType() == TypeUpdateAuthorizationState && typ.(*UpdateAuthorizationState).AuthorizationState.AuthorizationStateType() == TypeAuthorizationStateClosed {
close(client.responses)
}
}
func (client *Client) receiver() {
@ -257,7 +261,3 @@ func (client *Client) AddEventReceiver(msgType Type, channelCapacity int) *Liste
return listener
}
func (client *Client) Stop() {
client.Destroy()
}