improved knowledge of the circuit's buffer size

This commit is contained in:
Jeff Hill
2009-07-25 01:04:14 +00:00
parent 1ba658b452
commit 31fb3775fd
6 changed files with 35 additions and 61 deletions
+9 -26
View File
@@ -500,38 +500,21 @@ bufSizeT casDGIntfIO::optimumInBufferSize ()
#endif
}
bufSizeT casDGIntfIO::optimumOutBufferSize ()
bufSizeT casDGIntfIO ::
osSendBufferSize () const
{
#if 1
//
// must update client before the message size can be
// increased here
//
return MAX_UDP_SEND;
#else
int n;
int size;
int status;
/* fetch the TCP send buffer size */
n = sizeof(size);
status = getsockopt(
this->sock,
SOL_SOCKET,
SO_SNDBUF,
(char *)&size,
&n);
if(status < 0 || n != sizeof(size)){
int size = MAX_UDP_SEND;
int n = sizeof ( size );
int status = getsockopt( this->sock, SOL_SOCKET, SO_SNDBUF,
reinterpret_cast < char * > ( & size ), & n );
if ( status < 0 || n != sizeof(size) ) {
size = MAX_UDP_SEND;
}
if (size<=0) {
if ( size <= MAX_UDP_SEND ) {
size = MAX_UDP_SEND;
}
return (bufSizeT) size;
#endif
return static_cast < bufSizeT > ( size );
}
SOCKET casDGIntfIO::makeSockDG ()
+1 -1
View File
@@ -39,10 +39,10 @@ public:
inBufClient::fillParameter parm, bufSizeT & nBytesActual, caNetAddr & addr );
virtual void show ( unsigned level ) const;
static bufSizeT optimumOutBufferSize ();
static bufSizeT optimumInBufferSize ();
bufSizeT incomingBytesPresent () const;
bufSizeT osSendBufferSize () const ;
private:
tsFreeList < ipIgnoreEntry, 128 > ipIgnoreEntryFreeList;
-1
View File
@@ -236,4 +236,3 @@ caNetAddr casIntfIO::serverAddress () const
{
return caNetAddr (this->addr);
}
+1 -1
View File
@@ -53,7 +53,7 @@ public:
clientBufMemoryManager & ) const;
caNetAddr serverAddress () const;
private:
SOCKET sock;
struct sockaddr_in addr;
+21 -29
View File
@@ -19,7 +19,8 @@
casStreamIO::casStreamIO ( caServerI & cas, clientBufMemoryManager & bufMgr,
const ioArgsToNewStreamIO & args ) :
casStrmClient ( cas, bufMgr ), sock ( args.sock ), addr ( args.addr),
blockingFlag ( xIsBlocking ), sockHasBeenShutdown ( false )
_osSendBufferSize ( MAX_TCP ), blockingFlag ( xIsBlocking ),
sockHasBeenShutdown ( false )
{
assert ( sock >= 0 );
int yes = true;
@@ -91,7 +92,19 @@ casStreamIO::casStreamIO ( caServerI & cas, clientBufMemoryManager & bufMgr,
throw S_cas_internal;
}
#endif
/* cache the TCP send buffer size */
int size = MAX_TCP;
int n = sizeof ( size ) ;
status = getsockopt ( this->sock, SOL_SOCKET,
SO_SNDBUF, reinterpret_cast < char * > ( & size ), & n );
if ( status < 0 || n != sizeof ( size ) ) {
size = MAX_TCP;
}
if ( size <= MAX_TCP ) {
size = MAX_TCP;
}
_osSendBufferSize = static_cast < bufSizeT > ( size );
}
// casStreamIO::~casStreamIO()
@@ -255,8 +268,9 @@ xBlockingStatus casStreamIO::blockingState() const
return this->blockingFlag;
}
// casStreamIO::incomingBytesPresent()
bufSizeT casStreamIO::incomingBytesPresent () const // X aCC 361
// casStreamIO :: incomingBytesPresent()
bufSizeT casStreamIO :: incomingBytesPresent () const
{
int status;
osiSockIoctl_t nchars = 0;
@@ -293,32 +307,10 @@ void casStreamIO::hostName ( char * pInBuf, unsigned bufSizeIn ) const
ipAddrToA ( & this->addr, pInBuf, bufSizeIn );
}
// casStreamIO:::optimumBufferSize()
bufSizeT casStreamIO::optimumBufferSize ()
// casStreamIO :: osSendBufferSize ()
bufSizeT casStreamIO :: osSendBufferSize () const
{
#if 0
int n;
int size;
int status;
/* fetch the TCP send buffer size */
n = sizeof ( size) ;
status = getsockopt ( this->sock, SOL_SOCKET,
SO_SNDBUF, (char *) & size, & n );
if ( status < 0 || n != sizeof ( size ) ) {
size = 0x400;
}
if (size<=0) {
size = 0x400;
}
printf("the tcp buf size is %d\n", size);
return (bufSizeT) size;
#else
// this needs to be MAX_TCP (until we fix the array problem)
return (bufSizeT) MAX_TCP; // X aCC 392
#endif
return _osSendBufferSize;
}
// casStreamIO::getFD()
+3 -3
View File
@@ -31,16 +31,16 @@ public:
void xSetNonBlocking ();
const caNetAddr getAddr() const;
void hostName ( char *pBuf, unsigned bufSize ) const;
bufSizeT incomingBytesPresent () const;
bufSizeT osSendBufferSize () const;
private:
SOCKET sock;
struct sockaddr_in addr;
bufSizeT _osSendBufferSize;
xBlockingStatus blockingFlag;
bool sockHasBeenShutdown;
xBlockingStatus blockingState() const;
bufSizeT incomingBytesPresent() const;
static bufSizeT optimumBufferSize ();
void osdShow ( unsigned level ) const;
outBufClient::flushCondition osdSend ( const char *pBuf, bufSizeT nBytesReq,
bufSizeT & nBytesActual );