Changeset 2493


Ignore:
Timestamp:
Jan 26, 2011, 9:40:02 PM (10 years ago)
Author:
schwittmann
Message:

External Client: choose device on startup

Location:
trunk/CrypPlugins/KeySearcher/ExternalClient
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/KeySearcher/ExternalClient/Main.cpp

    r2430 r2493  
    6666    serv_addr.sin_port = htons(port);
    6767
     68    Cryptool cryptool;
     69
    6870    while(true)
    6971    {
     
    7375            continue;
    7476        }
    75         networkThread(serv_addr, port, password);
     77        networkThread(serv_addr, port, password, &cryptool);
    7678        printf("Reconnecting in %u seconds\n", RECONNECT_TIME);
    7779        sleep(RECONNECT_TIME);
  • trunk/CrypPlugins/KeySearcher/ExternalClient/Network.cpp

    r2486 r2493  
    2020#include "Cryptool.h"
    2121
    22 Cryptool* cryptool = 0;
    23 
    24 std::string getIdentificationStr()
     22std::string getIdentificationStr(Cryptool* cryptool)
    2523{
    2624    std::stringstream out;
     
    6563// Queue of completed jobs
    6664std::queue<JobResult> finishedJobs;
    67 void GetJobsAndPostResults(PlatformIndependentWrapper& wrapper, const char* password)
     65void GetJobsAndPostResults(PlatformIndependentWrapper& wrapper, const char* password, Cryptool* cryptool)
    6866{
    69     if (cryptool == 0)
    70         cryptool = new Cryptool();
    71 
    7267    wrapper.WriteInt(ClientOpcodes::HELLO);
    73     wrapper.WriteString(getIdentificationStr());
     68    wrapper.WriteString(getIdentificationStr(cryptool));
    7469    wrapper.WriteString(password);
    7570
     
    120115}
    121116
    122 void networkThread(sockaddr_in serv_addr, int port, const char* password)
     117void networkThread(sockaddr_in serv_addr, int port, const char* password, Cryptool* cryptool)
    123118{
    124119    printf("Connecting to %s on port %i\n", inet_ntoa(serv_addr.sin_addr), port);
     
    147142    try{
    148143        PlatformIndependentWrapper w(sockfd);
    149         GetJobsAndPostResults(w, password);
     144        GetJobsAndPostResults(w, password, cryptool);
    150145    } catch(SocketException)
    151146    {
  • trunk/CrypPlugins/KeySearcher/ExternalClient/Network.h

    r2417 r2493  
    1 void networkThread(sockaddr_in, int, const char*);
     1#pragma once
    22
     3#include "Cryptool.h"
     4
     5void networkThread(sockaddr_in, int, const char*, Cryptool* cryptool);
     6
Note: See TracChangeset for help on using the changeset viewer.