: login(l),
password(pwd),
ip(i),
- aliveTimeout(0),
- userTimeout(0),
+ aliveTimeout(5),
+ userTimeout(60),
phase(1),
phaseChangeTime(0),
- rnd(0)
+ rnd(0),
+ sock(-1)
{
unsigned char key[IA_PASSWD_LEN];
memset(key, 0, IA_PASSWD_LEN);
userTimeout(rvalue.userTimeout),
phase(1),
phaseChangeTime(0),
- rnd(0)
+ rnd(0),
+ sock(-1)
{
unsigned char key[IA_PASSWD_LEN];
memset(key, 0, IA_PASSWD_LEN);
USER::~USER()
{
-close(sock);
+if (sock > 0)
+ close(sock);
}
const USER & USER::operator=(const USER & rvalue)
phase = 1;
phaseChangeTime = 0;
rnd = 0;
+sock = -1;
unsigned char key[IA_PASSWD_LEN];
memset(key, 0, IA_PASSWD_LEN);
{
sock = socket(AF_INET, SOCK_DGRAM, 0);
+if (sock < 0)
+ {
+ throw std::runtime_error(std::string("USER::USER() - socket creation error: '") + strerror(errno) + "', ip: " + inet_ntostring(ip) + ", login: " + login);
+ }
+
struct sockaddr_in addr;
addr.sin_family = AF_INET;
{
throw std::runtime_error(std::string("USER::USER() - bind error: '") + strerror(errno) + "', ip: " + inet_ntostring(ip) + ", login: " + login);
}
+
+return true;
}