Bug: The write_to_descriptor function doesn't check if the socket is blocking input.
Found by: Orion Elder
Fixed by: Orion Elder, Rustry
Find the write_to_descriptor function and replace it with:
* Lowest level output function. Write a block of text to the file descriptor.
* If this gives errors on very long blocks (like 'ofind all'), try lowering
* the max block size.
* Added block checking to prevent random booting of the descriptor. Thanks go
* out to Rustry for his suggestions. -Orion
bool write_to_descriptor( int desc, char *txt, int length )
int iStart = 0;
int nWrite = 0;
int nBlock = 0;
int iErr = 0;
if ( length <= 0 )
length = strlen(txt);
for ( iStart = 0; iStart < length; iStart += nWrite )
nBlock = UMIN( length - iStart, 4096 );
nWrite = send( desc, txt + iStart, nBlock, 0 );
if ( nWrite == -1 )
iErr = WSAGetLastError ();
iErr = errno;
if ( iErr == EWOULDBLOCK )
* This is a SPAMMY little bug error. I would suggest
* not using it, but I've included it in case. -Orion
perror( "Write_to_descriptor: Send is blocking" );
nWrite = 0;
perror( "Write_to_descriptor" );
This fix has been installed on both an AFKMud and a Chronicles MUD for awhile now, with no noticable problems.