Giter VIP home page Giter VIP logo

Comments (9)

zelenin avatar zelenin commented on September 21, 2024

go-tdlib supports the new client design already.
#45

from go-tdlib.

livelace avatar livelace commented on September 21, 2024

Hm, it seems that doesn't work for me. I get this error just at the time of a second client creation (custom listeners are even not created yet). I tried go-tdlib 0.4 with tdlib 1.7.0.

from go-tdlib.

livelace avatar livelace commented on September 21, 2024

2netwalkers

This short example will give you error:

[ 0][t 0][1618062097.475765943][Client.cpp:277] Receive is called after Client destroy, or simultaneously from different threads

Due to https://github.com/tdlib/td/blob/eb80924dad30af4e6d8385d058bb7e847174df5e/td/telegram/td_json_client.h#L70

So, I decided to make some small changes to my app and restrict it with one telegram client per instance, because I don't see an easy way to support multiple clients right now.

package main

import (
	"log"
	"path/filepath"
	"time"

	"github.com/zelenin/go-tdlib/client"
)

func getClient(d string) {
	// client authorizer
	authorizer := client.ClientAuthorizer()
	go client.CliInteractor(authorizer)

	const (
            apiId   = 00000
            apiHash = "8pu9yg32qkuukj83ozaqo5zzjwhkxhnk"
	)

	authorizer.TdlibParameters <- &client.TdlibParameters{
		UseTestDc:              false,
		DatabaseDirectory:      filepath.Join(d + "/.tdlib", "database"),
		FilesDirectory:         filepath.Join(d + "/.tdlib", "files"),
		UseFileDatabase:        true,
		UseChatInfoDatabase:    true,
		UseMessageDatabase:     true,
		UseSecretChats:         false,
		ApiId:                  apiId,
		ApiHash:                apiHash,
		SystemLanguageCode:     "en",
		DeviceModel:            "Server",
		SystemVersion:          "1.0.0",
		ApplicationVersion:     "1.0.0",
		EnableStorageOptimizer: true,
		IgnoreFileNames:        false,
	}

	logVerbosity := client.WithLogVerbosity(&client.SetLogVerbosityLevelRequest{
		NewVerbosityLevel: 0,
	})

	c, err := client.NewClient(authorizer, logVerbosity)
	me, err := c.GetMe()
	if err != nil {
		log.Fatalf("GetMe error: %s", err)
	}
	log.Printf("Me: %s %s [%s]", me.FirstName, me.LastName, me.Username)
}

func main() {
	go getClient("a")
	go getClient("b")

	time.Sleep(900 * time.Second)
}

from go-tdlib.

zelenin avatar zelenin commented on September 21, 2024

@livelace i will check it

from go-tdlib.

savely-krasovsky avatar savely-krasovsky commented on September 21, 2024

Same problem :( Have to downgrade.

from go-tdlib.

askovpen avatar askovpen commented on September 21, 2024

[ 0][t 0][1619345016.295426607][Client.cpp:277] Receive is called after Client destroy, or simultaneously from different threads

from go-tdlib.

savely-krasovsky avatar savely-krasovsky commented on September 21, 2024

Any news?

from go-tdlib.

godcong avatar godcong commented on September 21, 2024
		DatabaseDirectory:      filepath.Join(d + "/.tdlib", "database"),
		FilesDirectory:         filepath.Join(d + "/.tdlib", "files"),

can write different path to fix?

from go-tdlib.

askovpen avatar askovpen commented on September 21, 2024

fixed in e5d2ffd

from go-tdlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.