Changeset 19 in chevmsgr
- Timestamp:
- 11/23/15 23:39:17 (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/msg.hpp
r18 r19 178 178 179 179 public : 180 SecureSocket() {} 180 SecureSocket() 181 { 182 sock = NULL; 183 } 181 184 SecureSocket(cf::network::tcp * sock, const std::string & ip, const std::string & sms) 182 185 { 183 init(sock, ip, sms); 184 } 185 186 void init(cf::network::tcp * sock, const std::string & ip, const std::string & sms) 186 setSocket(sock); 187 setKey(ip, sms); 188 } 189 190 void setSocket(cf::network::tcp * sock) 187 191 { 188 192 this->sock = sock; 189 193 } 194 195 void setKey(const std::string & ip, const std::string & sms) 196 { 190 197 cf::bin seed = sms + DELIMITER + ip; 191 198 cf::bin key = crypto().sha256(seed); … … 206 213 void close() 207 214 { 208 sock->close(); 215 if (sock) 216 sock->close(); 209 217 } 210 218 }; -
trunk/msgsrv.cpp
r18 r19 590 590 int main(int argc, char ** argv) 591 591 { 592 if (argc != 2)592 if (argc != 3) 593 593 { 594 594 std::cerr << "-_-^" << std::endl;
Note:
See TracChangeset
for help on using the changeset viewer.