Function
isClientLockable
(
client: Socket,
transportName: string,
lockType: "read" | "write",
)
Source from the content-addressed store, hash-verified
| 111 | }; |
| 112 | |
| 113 | function isClientLockable( |
| 114 | client: Socket, |
| 115 | transportName: string, |
| 116 | lockType: "read" | "write", |
| 117 | ) { |
| 118 | switch (transportName) { |
| 119 | case "polling": |
| 120 | return ( |
| 121 | client.transport.name === "polling" && |
| 122 | (lockType === "write" || !client.transport.writable) |
| 123 | ); |
| 124 | case "websocket": |
| 125 | case "webtransport": |
| 126 | return ( |
| 127 | client.transport.name === "polling" && |
| 128 | !client.upgrading && |
| 129 | !client.upgraded |
| 130 | ); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | function isValidSessionId(str: string) { |
| 135 | return typeof str === "string" && str.length === 20; |
Tested by
no test coverage detected