Revision e34a9e8b src/clientconnection.cpp

View differences:

src/clientconnection.cpp
43 43
ClientConnection::ClientConnection( const std::string &socketFile )
44 44
 : control_(socketFile), data_(socketFile), good_(true)
45 45
{
46
  if (control_ && data_) {
47
    control_.write("CONTROL\n");
48
    std::string key;
49
    if (!control_.readLine(key)) {
50
      good_ = false;
51
      return;
52
    }
53
    key = stripTrailingWS(key);
54
    data_.write("DATA " + key + "\n");
55
    std::string welcome;
56
    if (!control_.readLine(welcome)) {
57
      good_ = false;
58
      return;
59
    }
46
  if (!control_ || !data_) {
47
    good_ = false;
48
    error_ = "Failed to connect to socket " + socketFile;
49
    return;
50
  }
51

  
52
  control_.write("CONTROL\n");
53
  std::string key;
54
  if (!control_.readLine(key)) {
55
    error_ = "Failed to read data key";
56
    good_ = false;
57
    return;
58
  }
59
  key = stripTrailingWS(key);
60
  data_.write("DATA " + key + "\n");
61
  std::string welcome;
62
  if (!control_.readLine(welcome)) {
63
    error_ = "Failed to read welcome message";
64
    good_ = false;
65
    return;
60 66
  }
61 67
}
62 68

  

Also available in: Unified diff