samirettali / tor-spider

A spider for Hidden Services
4 stars 0 forks source link

[Bug] cannot start the spider #4

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hi,

I am really interested to work with you on the tor-spider but I could not start the script.

$ go run *.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe20b3d]

goroutine 1 [running]:
main.main()
    /home/ubuntu/x0rzkov/tor-spider/main.go:65 +0x4cd
exit status 2

sounds like you want to defer visitedStorage.Client.Close() as it is not instanciated.

        visitedStorage := &redisstorage.Storage{
                Address:  redisURI,
                Password: "",
                DB:       0,
                Prefix:   "0",
        }
        defer visitedStorage.Client.Close()

Any way to fix it ?

Cheers, X

samirettali commented 4 years ago

That was a mistake, because the expression would get evaluated immediately but the storage was not initiated, the right thing to do is to wrap the call to the close method in a function.

Fixed in 157b7f095432197cbe5c392f071d94c3653f40d4.