  	if (rare(prev.size() > 255))
  	    prev.resize(255);
  	const string & v = *t;
-@@ -250,19 +214,25 @@ RemoteServer::msg_allterms(const string &message)
+@@ -250,19 +228,25 @@ RemoteServer::msg_allterms(const string &message)
      }
  
      send_message(REPLY_DONE, string());

   public:
     /** Construct a RemoteServer.
      *
@@ -192,18 +243,19 @@ class XAPIAN_VISIBILITY_DEFAULT RemoteServer : private RemoteConnection {
     /// Destructor.
     ~RemoteServer();
 

+    virtual void release_db(Xapian::Database *) = 0;
+    virtual void select_db(const std::vector<std::string> &, bool) = 0;
+    virtual void shutdown() {};
+
+    void cleanup();
 
     // all terms
     void msg_allterms(const std::string & message);
@@ -170,6 +150,79 @@ class XAPIAN_VISIBILITY_DEFAULT RemoteServer : private RemoteConnection {
     // get number of unique terms
     void msg_uniqueterms(const std::string & message);
 
