Skip to content

requestChannel cancel panic #122

Description

@chacent

Expected Behavior

Actual Behavior

发生异常: panic
"unreachable: should never occur socket.requestChannelCallback!"

Steps to Reproduce

rsocket.RequestChannel(func(remote flux.Flux) flux.Flux {
					var sub rx.Subscription
					remote.Subscribe(
						context.Background(),
						rx.OnSubscribe(func(ctx context.Context, s rx.Subscription) {
							sub = s
							sub.Request(1)
						}),
						rx.OnComplete(func() {
							print()
						}),
						rx.OnError(func(e error) {
							print()
						}),
						rx.OnNext(func(input payload.Payload) error {
							sub.Cancel() //for some reason,i don't want continue
							return nil
						}),
					)
					return flux.Create(func(ctx context.Context, s flux.Sink) {})
				}),

Possible Solution

	switch vv := v.(type) {
	case requestResponseCallbackReverse:
		vv.su.Cancel()
	case requestStreamCallbackReverse:
		vv.su.Cancel()
	case requestChannelCallback:
		vv.snd.Cancel() //should i?
	case respondChannelCallback:
		vv.snd.Cancel()
	default:
		panic(fmt.Sprintf("unreachable: should never occur %T!", vv))
	}

Your Environment

  • RSocket version(s) used:
  • Other relevant libraries versions (eg. netty, ...):
  • Platform (eg. JVM version (javar -version) or Node version (node --version)):
  • OS and version (eg uname -a):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions