File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @effect/rpc " : patch
3
+ ---
4
+
5
+ ensure socket close events are not errors in RpcServer
Original file line number Diff line number Diff line change @@ -1188,7 +1188,7 @@ const makeSocketProtocol = Effect.gen(function*() {
1188
1188
}
1189
1189
clients . set ( id , { write } )
1190
1190
1191
- yield * Effect . orDie ( Effect . interruptible ( socket . runRaw ( ( data ) => {
1191
+ yield * socket . runRaw ( ( data ) => {
1192
1192
try {
1193
1193
const decoded = parser . decode ( data ) as ReadonlyArray < FromClientEncoded >
1194
1194
if ( decoded . length === 0 ) return Effect . void
@@ -1201,7 +1201,11 @@ const makeSocketProtocol = Effect.gen(function*() {
1201
1201
} catch ( cause ) {
1202
1202
return writeRaw ( parser . encode ( ResponseDefectEncoded ( cause ) ) )
1203
1203
}
1204
- } ) ) )
1204
+ } ) . pipe (
1205
+ Effect . interruptible ,
1206
+ Effect . catchIf ( ( error ) => error . reason === "Close" , ( ) => Effect . void ) ,
1207
+ Effect . orDie
1208
+ )
1205
1209
}
1206
1210
1207
1211
const protocol = yield * Protocol . make ( ( writeRequest_ ) => {
You can’t perform that action at this time.
0 commit comments