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