Skip to content

Commit 92b0f68

Browse files
hlefnwf
authored andcommitted
tcpip: de-templatize with_sealed_socket.
This makes us save 128B. The check is on the error path anyways and is irrelevant to performance. Signed-off-by: Hugo Lefeuvre <[email protected]>
1 parent f822de1 commit 92b0f68

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/tcpip/network_wrapper.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ namespace
106106
* the socket is coming from a previous instantiation of the network
107107
* stack.
108108
*/
109-
template<bool IsCloseOperation = false>
110109
int with_sealed_socket(FunctionWrapper<int(SealedSocket *socket)> operation,
111-
Sealed<SealedSocket> sealedSocket)
110+
Sealed<SealedSocket> sealedSocket,
111+
bool isCloseOperation = false)
112112
{
113113
return with_restarting_checks(
114114
[&]() {
@@ -126,7 +126,7 @@ namespace
126126
"(epochs mismatch: socket = {}; current = {}).",
127127
socket->socketEpoch,
128128
currentSocketEpoch.load());
129-
if constexpr (!IsCloseOperation)
129+
if (!isCloseOperation)
130130
{
131131
// This should push the caller to free the socket.
132132
return -ENOTCONN;
@@ -792,7 +792,7 @@ int network_socket_close(Timeout *t,
792792
{
793793
return -EINVAL;
794794
}
795-
return with_sealed_socket<true /* this is a close operation */>(
795+
return with_sealed_socket(
796796
[=](SealedSocket *socket) {
797797
// We will fail to lock if the socket is coming from
798798
// a previous instance of the network stack as it set
@@ -969,7 +969,8 @@ int network_socket_close(Timeout *t,
969969
}
970970
return -ETIMEDOUT;
971971
},
972-
sealedSocket);
972+
sealedSocket,
973+
true /* this is a close operation */);
973974
}
974975

975976
NetworkReceiveResult

0 commit comments

Comments
 (0)