tcp socket disconnecting by remote
[chaz/yoink] / src / Moof / Service.cc
index 400006ba2eb6ee59a4e4dad2391b90dd3a55240a..3432ae6ac12c763857fe25d558442a18f192f66f 100644 (file)
@@ -38,7 +38,7 @@ int Service::handlePacket(SocketMultiplexer& sock,
        if (magic == SOLICIT)
        {
                Packet out;
-               out << RESPONSE << mAddress.service() << mText;
+               out << RESPONSE << mType << mName << mText;
                sock.socket().write(out);
                return 0;
        }
@@ -55,13 +55,15 @@ int ServiceFinder::handlePacket(SocketMultiplexer& sock,
                packet >> magic;
                if (magic == RESPONSE)
                {
-                       std::string service;
-                       std::string     text;
-
-                       packet >> service >> text;
-                       if (service == mService)
+                       std::string type;
+                       packet >> type;
+                       if (type == mType)
                        {
-                               mServices.push_back(Service(address, text));
+                               std::string name;
+                               std::string     text;
+                               packet >> name >> text;
+                               mServices.insert(std::make_pair(name,
+                                                                                               Service(address, name, text)));
                                return 0;
                        }
                }
@@ -73,7 +75,7 @@ int ServiceFinder::handlePacket(SocketMultiplexer& sock,
        return -1;
 }
 
-ServiceFinder::ServiceFinder(const std::string& service, int type)
+ServiceFinder::ServiceFinder(const std::string& type, int sockType)
 {
 }
 
This page took 0.019065 seconds and 4 git commands to generate.