* looking for bonzini@gnu.org--2004b/smalltalk--devo--2.2--patch-620 to compare with * comparing to bonzini@gnu.org--2004b/smalltalk--devo--2.2--patch-620 M lib-src/socketx.h M packages/tcp/AbstractSocketImpl.st M packages/tcp/IPSocketImpl.st M packages/tcp/Sockets.st M packages/tcp/cfuncs.st M packages/tcp/tcp.c * modified files --- orig/lib-src/socketx.h +++ mod/lib-src/socketx.h @@ -108,6 +108,8 @@ int win_recv(int fd, void* buffer, int n #include #include #include +#include + #define closesocket(x) close(x) #define is_socket_error(err) (errno == (err)) #define clear_socket_error() (errno = 0) --- orig/packages/tcp/AbstractSocketImpl.st +++ mod/packages/tcp/AbstractSocketImpl.st @@ -257,6 +257,14 @@ FileDescriptor subclass: AbstractSocketI ^remotePort ] + valueWithoutBuffering: aBlock [ + "Evaluate aBlock, ensuring that any data that it writes to the socket + is sent immediately to the network." + + + aBlock value + ] + optionAt: opt level: level size: size [ "Answer in a ByteArray of the given size the value of a socket option. The option identifier is in `opt' and the level is in `level'. A --- orig/packages/tcp/IPSocketImpl.st +++ mod/packages/tcp/IPSocketImpl.st @@ -381,6 +381,20 @@ SocketImpl subclass: TCPSocketImpl [ ^OOBSocketImpl ] + + valueWithoutBuffering: aBlock [ + "Evaluate aBlock, ensuring that any data that it writes to the socket + is sent immediately to the network." + + + ^[self optionAt: self class tcpNodelay + level: self class ipprotoTcp + put: 1. + aBlock value] ensure: + [self optionAt: self class tcpNodelay + level: self class ipprotoTcp + put: 0] + ] ] --- orig/packages/tcp/Sockets.st +++ mod/packages/tcp/Sockets.st @@ -1094,7 +1094,9 @@ AbstractSocket subclass: Socket [ "Flush the write buffer to the operating system" - self writeBuffer notNil ifTrue: [self writeBuffer flush] + self writeBuffer notNil ifTrue: [ + self implementation valueWithoutBuffering: [ + self writeBuffer flush]] ] isPeerAlive [ --- orig/packages/tcp/cfuncs.st +++ mod/packages/tcp/cfuncs.st @@ -96,6 +96,18 @@ TCPSocketImpl class extend [ ] + ipprotoTcp [ + + + + ] + + tcpNodelay [ + + + + ] + ] --- orig/packages/tcp/tcp.c +++ mod/packages/tcp/tcp.c @@ -233,6 +233,7 @@ constantFunction (ipprotoIcmp, IPPROTO_I constantFunction (ipprotoUdp, IPPROTO_UDP); constantFunction (ipprotoTcp, IPPROTO_TCP); constantFunction (ipprotoIp, IPPROTO_IP); +constantFunction (tcpNodelay, TCP_NODELAY); #ifdef IP_MULTICAST_TTL constantFunction (ipMulticastTtl, IP_MULTICAST_TTL); @@ -273,6 +274,7 @@ gst_initModule (VMProxy * proxy) vmProxy->defineCFunc ("TCPipMulticastIf", ipMulticastIf); vmProxy->defineCFunc ("TCPipAddMembership", ipAddMembership); vmProxy->defineCFunc ("TCPipDropMembership", ipDropMembership); + vmProxy->defineCFunc ("TCPtcpNodelay", tcpNodelay); vmProxy->defineCFunc ("TCPmsgPeek", msgPeek); vmProxy->defineCFunc ("TCPmsgOOB", msgOOB); vmProxy->defineCFunc ("TCPsolSocket", solSocket);