wangzhengquan
2020-06-12 407bf8847c2ed391833909233c95faf66cda195b
service/netdisk_service.c
@@ -4,14 +4,13 @@
#include "login_store.h"
#include "request_handler.h"
#include "properties_config.h"
#include "netdisk_factory.h"
#include <jsoncpp/json/json.h>
#include <nng/nng.h>
#include <nng/protocol/reqrep0/rep.h>
#include <nng/protocol/reqrep0/req.h>
using namespace std;
static int work(Netdisk_DownloadRequest drequest);
static int connectAndSend(const char *url, char * str);
@@ -23,7 +22,7 @@
PropertiesConfig config("../data/config.txt");
SafeQueue<Netdisk_DownloadRequest> task_queue(10);
SafeQueue<Netdisk_DownloadRequest> task_queue(100);
std::map<std::string, Netdisk *> userDeviceMap;
@@ -78,14 +77,12 @@
  Netdisk_LoginInfo loginInfo = loginStore.getLoginInfo(drequest.loginUUID);
  if (netdisk == NULL) {
    if(loginInfo.deviceType == "HC") {
      // std::cout << "new HCNetdisk" << std::endl;
      netdisk = new HCNetdisk();
    netdisk = NetdiskFacotory::create(loginInfo.deviceType);
    if(netdisk != NULL) {
      userDeviceMap.insert({loginInfo.loginUUID, netdisk});
    } else {
      err_msg(0, "无法识别的设备类型: %s", loginInfo.deviceType.c_str());
    }
  }
@@ -162,14 +159,7 @@
    } else {
      std::cerr << "Don't support " << method << std::endl;
    }
    // if (method == "login") {
    //   handleLogin(sock, request);
    // } else if (method == "downloadByTime") {
    //   handleDownloadByTimeAsync(sock, request);
    // } else {
    //   std::cerr << "Don't support " << method << std::endl;
    // }
    // Unrecognized command, so toss the buffer.
    nng_free(buf, sz);
  }
}