Skip to content

Commit

Permalink
uTP: use connection state to wait for SYN ACK
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottyPoi committed Sep 27, 2023
1 parent a2ece39 commit 0aa7a5f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
UtpSocketKey,
decodeHistoryNetworkContentKey,
BeaconLightClientNetworkContentType,
ConnectionState,
} from '../../../index.js'
import { EventEmitter } from 'events'

Expand Down Expand Up @@ -190,7 +191,7 @@ export class PortalNetworkUTP extends EventEmitter {
async _handleStatePacket(request: ContentRequest, packet: StatePacket): Promise<void> {
switch (request.requestCode) {
case RequestCode.FINDCONTENT_READ: {
if (packet.header.seqNr === request.socket.getSeqNr() - 1) {
if (request.socket.state === ConnectionState.SynSent) {
request.socket.setAckNr(packet.header.seqNr)
break
} else {
Expand Down

0 comments on commit 0aa7a5f

Please sign in to comment.