Ticket #153: remote-protocol-minor-version.patch
File remote-protocol-minor-version.patch, 3.9 KB (added by , 17 years ago) |
---|
-
docs/remote_protocol.html
7 7 <h1>Remote Backend Protocol</h1> 8 8 9 9 <p> 10 This document describes <em>version 29</em> of the protocol used by Xapian's10 This document describes <em>version 30</em> of the protocol used by Xapian's 11 11 remote backend. The protocol assumes a reliable two-way connection across which 12 12 arbitrary data can be sent - this could be provided by a TCP socket for example 13 13 (as it is with xapian-tcpsrv), but any such connection could be used. For … … 58 58 <h2>Server greeting and statistics</h2> 59 59 60 60 <ul> 61 <li> <code>REPLY_GREETING <protocol version> I<db doc count> I<last docid> B<has positions?> F<db average length></code>61 <li> <code>REPLY_GREETING <protocol major version> <protocol minor version> I<db doc count> I<last docid> B<has positions?> F<db average length></code> 62 62 </ul> 63 63 64 64 <p> 65 The protocol version is simply passed as a single byte (<code>'\x09'</code> 66 for version 9). 65 The protocol major and minor versions are passed as a single byte each (e.g. 66 <code>'\x1e\x01'</code> for version 30.1). The server and client must 67 understand the same protocol major version, and the server protocol minor 68 version must be greater than or equal to that of the client (this means that 69 the server understands newer MSG_<i>XXX</i>, but will only send newer 70 REPLY_<i>YYY</i> in response to an appropriate client message. 67 71 </p> 68 72 69 73 <h2>Exception</h2> -
net/remoteserver.cc
90 90 91 91 // Send greeting message. 92 92 string message; 93 message += char(XAPIAN_REMOTE_PROTOCOL_VERSION); 93 message += char(XAPIAN_REMOTE_PROTOCOL_MAJOR_VERSION); 94 message += char(XAPIAN_REMOTE_PROTOCOL_MINOR_VERSION); 94 95 message += encode_length(db->get_doccount()); 95 96 message += encode_length(db->get_lastdocid()); 96 97 message += (db->has_positions() ? '1' : '0'); -
common/remoteprotocol.h
32 32 // 27: Support for postlists (always passes the whole list across) 33 33 // 28: Pass document length in reply to MSG_TERMLIST 34 34 // 29: Serialisation of Xapian::Error includes error_string. 35 #define XAPIAN_REMOTE_PROTOCOL_VERSION 29 35 #define XAPIAN_REMOTE_PROTOCOL_MAJOR_VERSION 30 36 #define XAPIAN_REMOTE_PROTOCOL_MINOR_VERSION 0 36 37 37 38 /// Message types (client -> server). 38 39 enum message_type { -
backends/remote/remote-database.cc
74 74 const char *p = message.c_str(); 75 75 const char *p_end = p + message.size(); 76 76 77 if (*p != XAPIAN_REMOTE_PROTOCOL_VERSION) { 77 // The protocol major versions must match. The protocol minor version of 78 // the server must be >= that of the client. 79 int protocol_major = static_cast<unsigned char>(*p++); 80 int protocol_minor = static_cast<unsigned char>(*p++); 81 if (protocol_major != XAPIAN_REMOTE_PROTOCOL_MAJOR_VERSION || 82 protocol_minor < XAPIAN_REMOTE_PROTOCOL_MINOR_VERSION) { 78 83 string errmsg("Unknown protocol version "); 84 errmsg += om_tostring(protocol_major); 85 errmsg += '.'; 79 86 errmsg += om_tostring(int(*p)); 80 errmsg += " ("STRINGIZE(XAPIAN_REMOTE_PROTOCOL_ VERSION)" supported)";87 errmsg += " ("STRINGIZE(XAPIAN_REMOTE_PROTOCOL_MAJOR_VERSION)"."STRINGIZE(XAPIAN_REMOTE_PROTOCOL_MINOR_VERSION)" supported)"; 81 88 throw Xapian::NetworkError(errmsg, context); 82 89 } 83 ++p;84 90 85 91 doccount = decode_length(&p, p_end, false); 86 92 lastdocid = decode_length(&p, p_end, false);