Browse Source

Add version support

David Rose 24 years ago
parent
commit
639af88c04
2 changed files with 25 additions and 0 deletions
  1. 23 0
      pandatool/src/text-stats/textMonitor.cxx
  2. 2 0
      pandatool/src/text-stats/textMonitor.h

+ 23 - 0
pandatool/src/text-stats/textMonitor.cxx

@@ -40,6 +40,29 @@ got_hello() {
        << get_client_hostname() << "\n";
        << get_client_hostname() << "\n";
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: TextMonitor::got_bad_version
+//       Access: Public, Virtual
+//  Description: Like got_hello(), this is called when the "hello"
+//               message has been received from the client.  At this
+//               time, the client's hostname and program name will be
+//               known.  However, the client appears to be an
+//               incompatible version and the connection will be
+//               terminated; the monitor should issue a message to
+//               that effect.
+////////////////////////////////////////////////////////////////////
+void TextMonitor::
+got_bad_version(int client_major, int client_minor,
+                int server_major, int server_minor) {
+  nout
+    << "Rejected connection by " << get_client_progname()
+    << " from " << get_client_hostname()
+    << ".  Client uses PStats version "
+    << client_major << "." << client_minor
+    << ", while server expects PStats version "
+    << server_major << "." << server_minor << ".\n";
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: TextMonitor::new_data
 //     Function: TextMonitor::new_data
 //       Access: Public, Virtual
 //       Access: Public, Virtual

+ 2 - 0
pandatool/src/text-stats/textMonitor.h

@@ -22,6 +22,8 @@ public:
   virtual string get_monitor_name();
   virtual string get_monitor_name();
 
 
   virtual void got_hello();
   virtual void got_hello();
+  virtual void got_bad_version(int client_major, int client_minor,
+                               int server_major, int server_minor);
   virtual void new_data(int thread_index, int frame_number);
   virtual void new_data(int thread_index, int frame_number);
   virtual void lost_connection();
   virtual void lost_connection();
   virtual bool is_thread_safe();
   virtual bool is_thread_safe();