]> git.tdb.fi Git - libs/net.git/blobdiff - source/net/protocol.h
Allow the query part of a URL to be empty
[libs/net.git] / source / net / protocol.h
index 7ff63cb1e7dd12cc2a8fb3e9ba1e092062bcc754..256d978ec1d2ca0dfc24ce0bb29da4ac9f006445 100644 (file)
@@ -294,6 +294,8 @@ template<typename P>
 unsigned Protocol::serialize(const P &pkt, char *buf, unsigned size) const
 {
        const PacketTypeDef<P> &pdef = get_packet_by_class<P>();
+       if(!pdef.get_id())
+               throw std::invalid_argument("no packet id");
        char *ptr = pdef.serialize(pkt, buf+4, buf+size);
        size = ptr-buf;
        header_def.serialize(PacketHeader(pdef.get_id(), size), buf, buf+4);
@@ -455,9 +457,6 @@ const char *Protocol::Serializer<P, Head, S>::deserialize(P &pkt, const char *bu
 }
 
 
-template<typename P>
-unsigned Protocol::PacketTypeDef<P>::class_id = 0;
-
 template<typename P>
 Protocol::PacketTypeDef<P>::PacketTypeDef(unsigned i):
        PacketDefBase(i),