Latest release of The Server Framework: 6.6.3

Version 6.6.3 of The Server Framework was released today.

This release is mainly a bug fix release but it also adds support for Visual Studio 2015 and Windows 10 (though we don’t explicitly use any Windows 10 APIs). There are quite a lot of small changes due to us running Gimpel Lint over the code. Most of the changes will have fixed potential issues rather than issues that have actually been reported.

However, there are two serious fixes for the SChannel Option Pack for an issue that was introduced in Release 6.6.2 and which could cause corruption of the data flow in some situations and stalling and CPU pegging in another. There is also a fix which may prevent UDP datagram corruption, See here for more details.

As always, see the release notes here, for full details of all changes.

All clients using Release 6.6.2 of the SChannel Option Pack are advised to upgrade to this release.

Bug fixes:

  • JetByteTools::IO::CBuffer::Clear() which now correctly sets m_ioSize to zero.

  • JetByteTools::IO::CBufferList::BufferData so that it cannot access pBuffer before it’s initialised.

  • JetByteTools::IO::CLockableBufferProcessor::~CLockableBufferProcessor() to remove potential buffer leak.

  • JetByteTools::IO::CAsyncFileReader where we were checking the validity of data response flags incorrectly.

  • JetByteTools::SSPI::SChannel::CAsyncConnector::PerformWrite() where we could sometimes send invalid data.

  • JetByteTools::SSPI::SChannel::CAsyncConnector where we could sometimes get stuck in an infinite loop if we had decrypted data available but no application level read pending.

  • JetByteTools::Service::CService::ServiceMain() so that we set and clear the m_serviceStarting flag correctly.

  • Fix to all WSASend() and WSARecv() calls to prevent multiple threads from calling into the API on the same socket at the same time. See here for more details.

  • JetByteTools::Win32::CCallbackTimerWheel::EndTimeoutHandling() where we were leaking one shot timers.

  • JetByteTools::Win32::CThreadPool::OnThreadPoolThreadStopped() and JetByteTools::Win32::CThreadPoolEx::OnThreadPoolThreadStopped() so that the call to the monitor’s OnThreadPoolStopped() function is consistent and in the right place.

  • JetByteTools::Win32::CSmartHandle to deal with closing pseudo thread or process handles.

  • Fix to JetByteTools::Socket::CFilterDataBase to ensure that each filter knows how many writes it has issued and that they pass completions to the next layer when they should.

  • JetByteTools::Win32::TReusableIdManager::InternalTryFree() so that we now correctly merge intervals. Note that this bug was purely in the way we stored the intervals (which was less efficient than it could be) and did not affect the function of the manager.

  • JetByteTools::Win32::TZeroInitialiseExpandableBuffer::Resize() so that it doesn’t trash memory if you reduce the size of the buffer.

  • JetByteTools::Win32::TZeroInitialiseExpandableBuffer a fix to the assignment operator so that it actually compiles and works.


  • Ran Visual Lint using Gimpel PC Lint on all code and adjusted to remove warnings and fix bugs.
  • Added support for Visual Studio 2015.
  • Removed all use of exception specifications. We only ever used throw() but that’s now gone too.
  • Protected non-virtual destructors on interfaces are now virtual even though they you can’t delete the object via the interface.
  • All destructors that could throw exceptions now have optional “log and swallow” exception handlers which are enabled by default. This is better than ignoring the problem and being faced with a call to std::terminate() which can be hard to track down.
  • Changed JetByteTools::IO::CNonPooledBuffer so that it doesn’t have to be immutable. You can now create a non-pooled buffer and add data to it after creation.
  • Added JetByteTools::IO::CBufferChain::AvailableSpace() and JetByteTools::IO::CBufferChain::HasAvailableSpace()
  • Added JetByteTools::IO::CBufferChain::RemoveAsSingleBuffer() which will either consolidate a chain into the first buffer (if all the data will fit) or create a JetByteTools::IO::CNonPooledBuffer of the required size and return the data inthe new buffer.
  • Added the concept of a “purge handler” for buffer chains. This comes in the form of an interface JetByteTools::IO::CBufferChain::IHandlePurgedBufferRelease and a new override for JetByteTools::IO::CBufferChain::Purge which takes a purge handler and some user data. If the new version of purge is called the purge handler is called for each buffer purged from the chain and it is responsible for disposing of the purged buffer, normally by calling Release() on it. The reason for this is that it’s now possible to have a buffer chain of buffers which are ‘detached’ buffer chains. When purge is called in this situation a purge handler can now be supplied which recreates the buffer chains and, in turn, purges them.
  • Added new constructors for JetByteTools::IO::CAsyncFileWriter and JetByteTools::IO::CAsyncFileWriterEx that take a filename and a JetByteTools::Win32::CSmartHandle to an open file.
  • Changed constructor for JetByteTools::IO::CAsyncFileWriter that previously took a HANDLE to take a JetByteTools::Win32::CSmartHandle
  • Added JetByteTools::IO::CBufferAllocator::GetNumActive() and JetByteTools::IO::CBufferAllocator::GetNumPooled()
  • Added explicit support for building against OpenSSL libs built with VS2015 as previous versions are no longer link compatible. Note that these #pragma link lines assume our internal naming convention for OpenSSL libs.
  • Added JetByteTools::IO::CBufferChain::Detach(), JetByteTools::IO::CBufferChain::Attach() and JetByteTools::IO::CBufferChain::Splice(). These allow you to take a buffer chain and ‘detach’ it from the buffer chain object so that you can work in terms of a single buffer (with the additional buffers chained on in the normal way but inaccessible). You can then take such a buffer and ‘attach’ it back to a buffer chain object. This allows you to pass a buffer chain through an interface which only understands single buffers. Splice() allows you to take an existing buffer chain and add a ‘detached’ buffer chain to the end of it.
  • Changed the number of tabs used in the JetByteTools::Service::CServiceManager::GetExtraHelp() message so that the remove option lines up correctly. I think this may be a dialog font issue and it may be inconsistent on different platforms.
  • Added JetByteTools::Win32::CActivatableObject::CommandWrapper to remove duplication in the users of JetByteTools::Win32::CActivatableObject
  • Removed JetByteTools::Win32::CFileChangeMonitor as it was not used or compiled. The functionality is contained in JetByteTools::Win32::CDirectoryChangeMonitor.
  • Added JetByteTools::Win32::CNTPTime which converts SYSTEMTIME to and from NTP timestamps.
  • Changes to the various JetByteTools::Win32::ToString() implementations so that they remain consistent across Visual Studio versions. Visual Studio 2015 changes how precision is used in the printf family of functions and provides greater default precision. We limit precision to 17 in JetByteTools::Win32::ToString() so that the output is consistent with earlier versions of Visual Studio.
  • JetByteTools::Win32::TReusableIdManager::Release() now returns the id.
  • JetByteTools::Win32::CCommandLine::Parse() now takes a reference to a string that can be used to return an error message.
  • Added JetByteTools::Win32::IQueueTimers::SetTimerWithRefCountedTimer(), JetByteTools::Win32::IQueueTimers::CancelTimerWithRefCountedTimer() and JetByteTools::Win32::IQueueTimers::DestroyTimerWithRefCountedTimer() which deal with the common pattern of code required when the timer handle is a reference counted class.
  • Added JetByteTools::Win32::IQueueTimers::RefCountedTimer.
  • Added JetByteTools::Win32::IManageEnvironmentVariables::TryDeleteVariable().
  • Added locking to JetByteTools::Win32::CEnvironmentBlock so that it’s now safe to use from multiple threads.
  • Added checking when we lock JetByteTools::Win32::TLockableObjectPotentialOwner<> and JetByteTools::Win32::TReentrantLockableObjectPotentialOwner<> so that an exception is thrown if it’s already locked. Also changed how JetByteTools::Win32::TReentrantLockableObjectPotentialOwner<> is implemented as it was unnecessarilly complex.
  • Breaking Change VS2015’s exponent doesn’t include a leading 0 when calling sprintf, etc. This changes the output for some calls to JetByteTools::Win32::ToString() and makes it inconsistent with all previous releases.