Changeset 6411 for trunk/licq
- Timestamp:
- 07/04/08 03:27:41 (5 months ago)
- Location:
- trunk/licq
- Files:
-
- 4 modified
-
include/licq_socket.h (modified) (6 diffs)
-
src/icqd-threads.cpp (modified) (2 diffs)
-
src/icqd.cpp (modified) (1 diff)
-
src/socket.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/licq/include/licq_socket.h
r6395 r6411 36 36 { 37 37 public: 38 INetSocket(unsigned long _nOwner);39 38 INetSocket(const char *_szOwnerId, unsigned long _nOwnerPPID); 40 39 virtual ~INetSocket(); … … 46 45 unsigned long OwnerPPID() { return m_nOwnerPPID; } 47 46 void SetOwner(const char *s, unsigned long n); 48 unsigned long Owner() { return (m_nOwner); }49 void SetOwner(unsigned long _nOwner);50 47 unsigned long Version() { return (m_nVersion); } 51 48 void SetVersion(unsigned long _nVersion) { m_nVersion = _nVersion; } … … 100 97 char m_szID[4]; 101 98 int m_nSockType; 102 unsigned long m_nOwner;103 99 unsigned short m_nVersion; 104 100 SocketError_et m_nErrorType; … … 114 110 { 115 111 public: 116 TCPSocket(unsigned long _nOwner);117 112 TCPSocket(const char *s, unsigned long n); 118 113 TCPSocket(); … … 151 146 { 152 147 public: 153 SrvSocket(unsigned long _nOwner);154 148 SrvSocket(const char *s, unsigned long n); 155 149 virtual ~SrvSocket(); … … 172 166 { 173 167 public: 174 UDPSocket( unsigned long _nOwner);168 UDPSocket(const char* ownerId, unsigned long ownerPpid); 175 169 virtual ~UDPSocket(); 176 170 -
trunk/licq/src/icqd-threads.cpp
r6405 r6411 813 813 DEBUG_THREADS("[MonitorSockets_tep] Data on listening TCP socket." 814 814 "\n"); 815 TCPSocket *tcp = static_cast<TCPSocket *>(s);815 TCPSocket* tcp = static_cast<TCPSocket *>(s); 816 816 if (tcp == NULL) 817 817 { … … 821 821 else 822 822 { 823 TCPSocket *newSocket = new TCPSocket( 0);823 TCPSocket *newSocket = new TCPSocket(); 824 824 bool ok = tcp->RecvConnection(*newSocket); 825 825 gSocketManager.DropSocket(tcp); -
trunk/licq/src/icqd.cpp
r6405 r6411 385 385 int nResult = 0; 386 386 387 TCPSocket *s = new TCPSocket(0);387 TCPSocket* s = new TCPSocket(); 388 388 m_nTCPSocketDesc = StartTCPServer(s); 389 389 if (m_nTCPSocketDesc == -1) -
trunk/licq/src/socket.cpp
r6347 r6411 179 179 } 180 180 181 //-----INetSocket::SetOwner---------------------------------------------------182 void INetSocket::SetOwner(unsigned long _nOwner)183 {184 m_nOwner = _nOwner;185 if (_nOwner)186 {187 char szUin[24];188 sprintf(szUin, "%lu", _nOwner);189 m_szOwnerId = strdup(szUin);190 m_nOwnerPPID = LICQ_PPID;191 }192 else193 {194 m_szOwnerId = 0;195 m_nOwnerPPID = 0;196 }197 }198 199 181 void INetSocket::SetOwner(const char *_szOwnerId, unsigned long _nOwnerPPID) 200 182 { 201 183 m_szOwnerId = strdup(_szOwnerId); 202 184 m_nOwnerPPID = _nOwnerPPID; 203 if (m_nOwnerPPID == LICQ_PPID)204 m_nOwner = strtoul(_szOwnerId, (char **)NULL, 10);205 else206 m_nOwner = 0;207 185 } 208 186 … … 266 244 267 245 268 //-----INetSocket::constructor--------------------------------------------------269 INetSocket::INetSocket(unsigned long _nOwner)270 {271 m_nDescriptor = -1;272 SetOwner(_nOwner);273 274 m_nVersion = 0;275 m_nErrorType = SOCK_ERROR_none;276 memset(&m_sRemoteAddr, 0, sizeof(struct sockaddr_in));277 memset(&m_sLocalAddr, 0, sizeof(struct sockaddr_in));278 m_szRemoteName = NULL;279 m_xProxy = NULL;280 m_nChannel = ICQ_CHNxNONE;281 282 // Initialise the mutex283 pthread_mutex_init(&mutex, NULL);284 }285 286 246 INetSocket::INetSocket(const char *_szOwnerId, unsigned long _nOwnerPPID) 287 247 { … … 292 252 m_szOwnerId = 0; 293 253 m_nOwnerPPID = _nOwnerPPID; 294 if (m_nOwnerPPID == LICQ_PPID)295 m_nOwner = strtoul(_szOwnerId, (char **)NULL, 10);296 else297 m_nOwner = 0;298 254 m_nVersion = 0; 299 255 m_nErrorType = SOCK_ERROR_none; … … 638 594 //=====SrvSocket=============================================================== 639 595 640 SrvSocket::SrvSocket(unsigned long _nOwner) : INetSocket(_nOwner)641 {642 strcpy(m_szID, "SRV");643 m_nSockType = SOCK_STREAM;644 }645 646 596 SrvSocket::SrvSocket(const char *s, unsigned long n) : INetSocket(s, n) 647 597 { … … 826 776 return true; 827 777 } 828 778 829 779 //=====TCPSocket=============================================================== 830 TCPSocket::TCPSocket(unsigned long _nOwner) : INetSocket(_nOwner)831 {832 strcpy(m_szID, "TCP");833 m_nSockType = SOCK_STREAM;834 m_p_SSL = NULL;835 }836 837 780 TCPSocket::TCPSocket(const char *s, unsigned long n) : INetSocket(s, n) 838 781 { … … 906 849 m_szOwnerId = 0; 907 850 m_nOwnerPPID = from.m_nOwnerPPID; 908 909 if (m_nOwnerPPID == LICQ_PPID)910 m_nOwner = from.m_nOwner;911 851 912 852 m_nVersion = from.m_nVersion; … … 1376 1316 #endif /*-----End of OpenSSL code------------------------------------------*/ 1377 1317 1378 UDPSocket::UDPSocket(unsigned long _nOwner) : INetSocket(_nOwner) 1318 UDPSocket::UDPSocket(const char* ownerId, unsigned long ownerPpid) 1319 : INetSocket(ownerId, ownerPpid) 1379 1320 { 1380 1321 strcpy(m_szID, "UDP");
