Skip to content

Commit

Permalink
use recv complete
Browse files Browse the repository at this point in the history
  • Loading branch information
ami-GS committed Oct 6, 2023
1 parent 41d7144 commit b3f71e9
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 18 deletions.
19 changes: 19 additions & 0 deletions scripts/TcpTests.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@
"ResultsMatcher": ".*@ (.*) kbps.*",
"Formats": ["{0} kbps"],
"RegressionThreshold": "-8.0"
},
{
"TestName": "TcpThroughputUp",
"Local" : {
"Platform": "linux",
"Tls": ["openssl", "openssl3"],
"Arch": ["x64", "arm"],
"Exe": "secnetperf",
"Arguments": "-test:Throughput -target:$RemoteAddress -bind:$LocalAddress:4434 -ip:4 -uni:1 -upload:2000000000 -tcp:1"
},
"Variables": [
],
"AllowLoopback": true,
"Iterations": 5,
"RemoteReadyMatcher": "Started!",
"ResultsMatcher": ".*@ (.*) kbps.*",
"FailureDefault": "Result: 0 bytes @ 0 kbps (0.0 ms).",
"Formats": ["{0} kbps"],
"RegressionThreshold": "-60.0"
}
]
}
60 changes: 42 additions & 18 deletions src/platform/datapath_epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -1623,18 +1623,32 @@ CxPlatSocketHandleErrors(
ErrNum,
"Socket error event");

//
// Send unreachable notification to MsQuic if any related
// errors were received.
//
if (ErrNum == ECONNREFUSED ||
ErrNum == EHOSTUNREACH ||
ErrNum == ENETUNREACH) {
if (!SocketContext->Binding->PcpBinding) {
SocketContext->Binding->Datapath->UdpHandlers.Unreachable(
if (SocketContext->Binding->Type == CXPLAT_SOCKET_UDP) {
//
// Send unreachable notification to MsQuic if any related
// errors were received.
//
if (ErrNum == ECONNREFUSED ||
ErrNum == EHOSTUNREACH ||
ErrNum == ENETUNREACH) {
if (!SocketContext->Binding->PcpBinding) {
SocketContext->Binding->Datapath->UdpHandlers.Unreachable(
SocketContext->Binding,
SocketContext->Binding->ClientContext,
&SocketContext->Binding->RemoteAddress);
}
}
} else if (ErrNum == ENOTSOCK ||
ErrNum == EINTR ||
ErrNum == ECANCELED ||
ErrNum == ECONNABORTED ||
ErrNum == ECONNRESET) {
if (!SocketContext->Binding->DisconnectIndicated) {
SocketContext->Binding->DisconnectIndicated = TRUE;
SocketContext->Binding->Datapath->TcpHandlers.Connect(
SocketContext->Binding,
SocketContext->Binding->ClientContext,
&SocketContext->Binding->RemoteAddress);
FALSE);
}
}
}
Expand Down Expand Up @@ -2257,6 +2271,13 @@ SocketSend(
CxPlatSocketContextSetEvents(SocketContext, EPOLL_CTL_MOD, EPOLLIN | EPOLLOUT);
Status = QUIC_STATUS_SUCCESS;
} else {
if (Socket->Type != CXPLAT_SOCKET_UDP) {
SocketContext->Binding->Datapath->TcpHandlers.SendComplete(
SocketContext->Binding,
SocketContext->Binding->ClientContext,
errno,
SendData->TotalSize);
}
CxPlatSendDataFree(SendData);
}

Expand Down Expand Up @@ -2516,14 +2537,10 @@ CxPlatSendDataSend(
Status == EHOSTUNREACH ||
Status == ENETUNREACH) {
if (!SocketContext->Binding->PcpBinding) {
if (SocketType == CXPLAT_SOCKET_UDP) {
SocketContext->Binding->Datapath->UdpHandlers.Unreachable(
SocketContext->Binding,
SocketContext->Binding->ClientContext,
&SocketContext->Binding->RemoteAddress);
} else {
// TODO - TCP error
}
SocketContext->Binding->Datapath->UdpHandlers.Unreachable(
SocketContext->Binding,
SocketContext->Binding->ClientContext,
&SocketContext->Binding->RemoteAddress);
}
}
}
Expand Down Expand Up @@ -2566,6 +2583,13 @@ CxPlatSocketContextFlushTxQueue(

CxPlatLockAcquire(&SocketContext->TxQueueLock);
CxPlatListRemoveHead(&SocketContext->TxQueue);
if (SocketContext->Binding->Type != CXPLAT_SOCKET_UDP) {
SocketContext->Binding->Datapath->TcpHandlers.SendComplete(
SocketContext->Binding,
SocketContext->Binding->ClientContext,
errno,
SendData->TotalSize);
}
CxPlatSendDataFree(SendData);
if (!CxPlatListIsEmpty(&SocketContext->TxQueue)) {
SendData =
Expand Down

0 comments on commit b3f71e9

Please sign in to comment.