mirror of
https://github.com/c0re100/gotdlib.git
synced 2026-02-21 20:20:17 +01:00
multi-instance fix
This commit is contained in:
parent
d916d47121
commit
e5d2ffd3f9
2 changed files with 26 additions and 8 deletions
|
|
@ -39,7 +39,7 @@ func (jsonClient *JsonClient) Send(req Request) {
|
|||
// shouldn't be called simultaneously from two different threads.
|
||||
// Returned pointer will be deallocated by TDLib during next call to td_json_client_receive or td_json_client_execute
|
||||
// in the same thread, so it can't be used after that.
|
||||
func (jsonClient *JsonClient) Receive(timeout time.Duration) (*Response, error) {
|
||||
func Receive(timeout time.Duration) (*Response, error) {
|
||||
result := C.td_receive(C.double(float64(timeout) / float64(time.Second)))
|
||||
if result == nil {
|
||||
return nil, errors.New("update receiving timeout")
|
||||
|
|
@ -54,10 +54,6 @@ func (jsonClient *JsonClient) Receive(timeout time.Duration) (*Response, error)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if resp.ClientId != jsonClient.id {
|
||||
return nil, errors.New("wrong @client_id")
|
||||
}
|
||||
|
||||
resp.Data = data
|
||||
|
||||
return &resp, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue