mirror of https://github.com/aria2/aria2
Enable TCP_NODELAY for WebSocket connection.
parent
bdd37fe3de
commit
332bda83b4
|
@ -300,6 +300,7 @@ AC_CHECK_HEADERS([argz.h \
|
|||
malloc.h \
|
||||
netdb.h \
|
||||
netinet/in.h \
|
||||
netinet/tcp.h \
|
||||
poll.h \
|
||||
port.h \
|
||||
stddef.h \
|
||||
|
|
|
@ -163,6 +163,7 @@ bool HttpServerCommand::execute()
|
|||
httpServer_->feedUpgradeResponse("websocket",
|
||||
fmt("Sec-WebSocket-Accept: %s\r\n",
|
||||
serverKey.c_str()));
|
||||
httpServer_->getSocket()->setTcpNodelay(true);
|
||||
Command* command =
|
||||
new rpc::WebSocketResponseCommand(getCuid(), httpServer_, e_,
|
||||
socket_);
|
||||
|
|
|
@ -506,6 +506,12 @@ void SocketCore::joinMulticastGroup
|
|||
setSockOpt(IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
|
||||
}
|
||||
|
||||
void SocketCore::setTcpNodelay(bool f)
|
||||
{
|
||||
int val = f;
|
||||
setSockOpt(IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
|
||||
}
|
||||
|
||||
void SocketCore::setNonBlockingMode()
|
||||
{
|
||||
#ifdef __MINGW32__
|
||||
|
|
|
@ -125,6 +125,9 @@ public:
|
|||
(const std::string& multicastAddr, uint16_t multicastPort,
|
||||
const std::string& localAddr);
|
||||
|
||||
// Enables TCP_NODELAY socket option if f == true.
|
||||
void setTcpNodelay(bool f);
|
||||
|
||||
void create(int family, int protocol = 0);
|
||||
|
||||
void bindWithFamily(uint16_t port, int family, int flags = AI_PASSIVE);
|
||||
|
|
|
@ -73,6 +73,10 @@
|
|||
# include <netinet/in.h>
|
||||
#endif // HAVE_NETINET_IN_H
|
||||
|
||||
#ifdef HAVE_NETINET_TCP_H
|
||||
# include <netinet/tcp.h>
|
||||
#endif // HAVE_NETINET_TCP_H
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif // HAVE_ARPA_INET_H
|
||||
|
|
Loading…
Reference in New Issue