dedis / onet

Overlay Network for distributed protocols
GNU Lesser General Public License v3.0
50 stars 29 forks source link

`ServiceProcessor.RegisterHandler` & `ServiceProcessor.RegisterStreamingHandler` fail for function with unscoped type of request #667

Open tharvik opened 3 years ago

tharvik commented 3 years ago

When register a handler with an unscoped (ie, not existing at the root of a package, such as struct{} used directly), it fails with the following.

RegisterHandler(func (struct{}) (struct{}, error))
panic: runtime error: index out of range [1] with length 1 [recovered]
    panic: runtime error: index out of range [1] with length 1
[...]
panic(0xa27f60, 0xc00009a000)
    /usr/lib/go/src/runtime/panic.go:969 +0x1b9
go.dedis.ch/onet/v3.(*ServiceProcessor).RegisterStreamingHandler(0xc00013bcb8, 0x9c89c0, 0xaa0718, 0x0, 0x0)
    /home/tharvik/c4dt/onet/processor.go:129 +0xa92
go.dedis.ch/onet/v3.(*ServiceProcessor).RegisterStreamingHandlers(0xc00013bcb8, 0xc00013bd08, 0x3, 0x3, 0xc0000686e0, 0xc000056cd4)
    /home/tharvik/c4dt/onet/processor.go:384 +0x6c
[...]

You can see some tests triggering it in #666.