File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
main/java/io/rsocket/core
test/java/io/rsocket/core Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,13 @@ public void request(long n) {
114
114
if (firstLoop ) {
115
115
firstLoop = false ;
116
116
try {
117
+ // since in all the scenarios where RequestOperator is used, the
118
+ // CorePublisher is either UnicastProcessor or UnicastProcessor.next()
119
+ // Therefore, we are free to propagate max demand immediately up on the first
120
+ // request. UnicastProcessor is only there to allow sending signals from the
121
+ // connection to a created stream and does not have to check the correctness
122
+ // of flow-control. For more info see
123
+ // https://github.com/rsocket/rsocket/blob/master/Protocol.md#handling-the-unexpected
117
124
this .s .request (Long .MAX_VALUE );
118
125
this .hookOnFirstRequest (n );
119
126
} catch (Throwable throwable ) {
Original file line number Diff line number Diff line change @@ -1142,15 +1142,22 @@ public void testWorkaround858() {
1142
1142
rule .assertHasNoLeaks ();
1143
1143
}
1144
1144
1145
- @ Test
1145
+ @ ParameterizedTest
1146
+ @ ValueSource (strings = {"stream" , "channel" })
1146
1147
// see https://github.com/rsocket/rsocket-java/issues/959
1147
- public void testWorkaround959 () {
1148
- for (int i = 1 ; i < 100000 ; i += 2 ) {
1148
+ public void testWorkaround959 (String type ) {
1149
+ for (int i = 1 ; i < 20000 ; i += 2 ) {
1149
1150
ByteBuf buffer = rule .alloc ().buffer ();
1150
1151
buffer .writeCharSequence ("test" , CharsetUtil .UTF_8 );
1151
1152
1152
1153
final AssertSubscriber <Payload > assertSubscriber = new AssertSubscriber <>(3 );
1153
- rule .socket .requestStream (ByteBufPayload .create (buffer )).subscribe (assertSubscriber );
1154
+ if (type .equals ("stream" )) {
1155
+ rule .socket .requestStream (ByteBufPayload .create (buffer )).subscribe (assertSubscriber );
1156
+ } else if (type .equals ("channel" )) {
1157
+ rule .socket
1158
+ .requestChannel (Flux .just (ByteBufPayload .create (buffer )))
1159
+ .subscribe (assertSubscriber );
1160
+ }
1154
1161
1155
1162
final ByteBuf payloadFrame =
1156
1163
PayloadFrameCodec .encode (
You can’t perform that action at this time.
0 commit comments