Name of changed file | |
| Version and , file | Version and , file |
| Line 1 in | Line 1 in |
Context line Removed line Changed line Context line | Context line Changed line Added line Context line |
Changelog | |
| /usr/src/Sockets-2.3.9.1/Changelog 2010-02-09 21:26:01.0, 0100 | /usr/src/Sockets-2.3.9.2/Changelog 2010-03-18 12:13:08.0, 0100 |
| Line 1 in Changelog | Line 1 in Changelog |
diff for next release always available @ http://www.alhem.net/Sockets/latest_diff.html 2.3.9.2 -------- More internal restructuring of SocketHandler. The Get() method has been removed. Set() has been split into three: ISocketHandler_Add(), ISocketHandler_Mod(), and ISocketHandler_Del(). New methods defined in ISocketHandler interface to support different models of socket io: ISocketHandler_Select(), MaxCount(). Removed Set() method from Socket class. Implemented SocketHandlerEp using epoll for linux only. reinterpret_cast<> added in ListenSocket for ipv6 address struct. HttpPostSocket member variable holding http headers (m_fields) is now protected (changed from private). Repaired Reconnect function in sockethandler. 2.3.9.1 -------- | |
HttpPostSocket.h | |
| /usr/src/Sockets-2.3.9.1/HttpPostSocket.h 2010-02-09 21:14:21.0, 0100 | /usr/src/Sockets-2.3.9.2/HttpPostSocket.h 2010-02-23 09:20:03.0, 0100 |
| Line 73 in HttpPostSocket.h | Line 73 in HttpPostSocket.h |
void OnConnect(); protected: std::map<std::string,std::list<std::string> > m_fields; private: HttpPostSocket(const HttpPostSocket& s) : HttpClientSocket(s) {} // copy constructor | |
| Line 78 in HttpPostSocket.h | Line 81 in HttpPostSocket.h |
void DoMultipartPost(); // std::map<std::string,std::list<std::string> > m_fields; std::map<std::string,std::string> m_files; std::string m_boundary; | |
ISocketHandler.h | |
| /usr/src/Sockets-2.3.9.1/ISocketHandler.h 2010-02-09 21:15:38.0, 0100 | /usr/src/Sockets-2.3.9.2/ISocketHandler.h 2010-03-18 12:07:06.0, 0100 |
| Line 97 in ISocketHandler.h | Line 98 in ISocketHandler.h |
/** Remove socket from socket map, used by Socket class. */ virtual void Remove(Socket *) = 0; public: /** Get status of read/write/exception file descriptor set for a socket. */ virtual void Get(SOCKET s,bool& r,bool& w,bool& e) = 0; /** Set read/write/exception file descriptor sets (fd_set). */ virtual void Set(SOCKET s,bool bRead,bool bWrite,bool bException = true) = 0; /** Wait for events, generate callbacks. */ | /** Remove socket from socket map, used by Socket class. */ virtual void Remove(Socket *) = 0; /** Actual call to select() */ virtual int ISocketHandler_Select(struct timeval *) = 0; public: /** Set read/write/exception file descriptor sets (fd_set). */ virtual void ISocketHandler_Add(Socket *,bool bRead,bool bWrite) = 0; virtual void ISocketHandler_Mod(Socket *,bool bRead,bool bWrite) = 0; virtual void ISocketHandler_Del(Socket *) = 0; /** Wait for events, generate callbacks. */ |
| Line 118 in ISocketHandler.h | Line 123 in ISocketHandler.h |
virtual size_t GetCount() = 0; /** Return maximum number of sockets allowed. */ virtual size_t MaxCount() = 0; /** Override and return false to deny all incoming connections. \param p ListenSocket class pointer (use GetPort to identify which one) */ | |
ListenSocket.h | |
| /usr/src/Sockets-2.3.9.1/ListenSocket.h 2010-02-09 21:15:40.0, 0100 | /usr/src/Sockets-2.3.9.2/ListenSocket.h 2010-03-18 12:07:15.0, 0100 |
| Line 349 in ListenSocket.h | Line 348 in ListenSocket.h |
return; } if (Handler().GetCount() >= FD_SETSIZE) { Handler().LogError(this, "accept", (int)Handler().GetCount(), "ISocketHandler fd_set limit reached", LOG_LEVEL_FATAL); closesocket(a_s); return; | return; } if (Handler().GetCount() >= Handler().MaxCount()) { Handler().LogError(this, "accept", (int)Handler().GetCount(), "ISocketHandler socket limit reached", LOG_LEVEL_FATAL); closesocket(a_s); return; |
| Line 367 in ListenSocket.h | Line 366 in ListenSocket.h |
if (sa_len == sizeof(struct sockaddr_in6)) { struct sockaddr_in6 *p = (struct sockaddr_in6 *)&sa; if (p -> sin6_family == AF_INET6) { Ipv6Address ad(p -> sin6_addr,ntohs(p -> sin6_port)); ad.SetFlowinfo(p -> sin6_flowinfo); #ifndef _WIN32 ad.SetScopeId(p -> sin6_scope_id); #endif tmp -> SetRemoteAddress(ad); | if (sa_len == sizeof(struct sockaddr_in6)) { if (reinterpret_cast<struck sockaddr_in6&>(sa).sin6_family == AF_INET6) { Ipv6Address ad(reinterpret_cast<struck sockaddr_in6&>(sa).sin6_addr, ntohs(reinterpret_cast<struck sockaddr_in6&>(sa).sin6_port)); ad.SetFlowinfo(reinterpret_cast<struck sockaddr_in6&>(sa).sin6_flowinfo); #ifndef _WIN32 ad.SetScopeId(reinterpret_cast<struck sockaddr_in6&>(sa).sin6_scope_id); #endif tmp -> SetRemoteAddress(ad); |
Makefile | |
| /usr/src/Sockets-2.3.9.1/Makefile 2010-02-06 20:02:11.0, 0100 | /usr/src/Sockets-2.3.9.2/Makefile 2010-02-21 09:57:49.0, 0100 |
| Line 127 in Makefile | Line 127 in Makefile |
Project.net/Test/*.vcproj \ DevCpp/*.dev tests/Makefile tests/*.cpp \ OSX.zip pkgconfig/*pc tar: clean | Project.net/Test/*.vcproj \ DevCpp/*.dev tests/Makefile tests/*.cpp \ OSX.zip pkgconfig/*.IN tar: clean |
| Line 177 in Makefile | Line 177 in Makefile |
doxygen doxygen.cfg ./packdocs.sh Sockets-$(VERSION)-doxygendocs cvs up tmpdocs: clean | doxygen doxygen.cfg ./packdocs.sh Sockets-$(VERSION)-doxygendocs svn up tmpdocs: clean |
| Line 193 in Makefile | Line 193 in Makefile |
rm -rf /usr/local/apache/www.alhem.net/htdocs/Sockets-tmp/html doxygen doxygen-tmp.cfg cvs up | rm -rf /usr/local/apache/www.alhem.net/htdocs/Sockets-tmp/html doxygen doxygen-tmp.cfg svn up |
Makefile.version | |
| /usr/src/Sockets-2.3.9.1/Makefile.version 2010-02-09 20:47:45.0, 0100 | /usr/src/Sockets-2.3.9.2/Makefile.version 2010-03-18 12:04:36.0, 0100 |
| Line 1 in Makefile.version | Line 1 in Makefile.version |
MAJOR = 2 MINOR = 3.9.1 VERSION = $(MAJOR).$(MINOR) DIFF_VERSION = 2.3.9 # Sockets | MAJOR = 2 MINOR = 3.9.2 VERSION = $(MAJOR).$(MINOR) DIFF_VERSION = 2.3.9.1 # Sockets |
| Line 43 in Makefile.version | Line 43 in Makefile.version |
Socket.o \ SocketHandler.o \ SocketHandlerEp.o \ SocketStream.o \ StdoutLog.o \ | |
Socket.cpp | |
| /usr/src/Sockets-2.3.9.1/Socket.cpp 2010-02-09 21:16:30.0, 0100 | /usr/src/Sockets-2.3.9.2/Socket.cpp 2010-03-18 12:07:54.0, 0100 |
| Line 185 in Socket.cpp | Line 185 in Socket.cpp |
} int n; Handler().ISocketHandler_Del(this); // remove from fd_set's if ((n = closesocket(m_socket)) == -1) { | |
| Line 190 in Socket.cpp | Line 191 in Socket.cpp |
Handler().LogError(this, "close", Errno, StrError(Errno), LOG_LEVEL_ERROR); } Handler().Set(m_socket, false, false, false); // remove from fd_set's m_socket = INVALID_SOCKET; return n; | |
| Line 448 in Socket.cpp | Line 448 in Socket.cpp |
void Socket::Set(bool bRead, bool bWrite, bool bException) { Handler().Set(m_socket, bRead, bWrite, bException); } bool Socket::Ready() { | |
Socket.h | |
| /usr/src/Sockets-2.3.9.1/Socket.h 2010-02-09 21:16:31.0, 0100 | /usr/src/Sockets-2.3.9.2/Socket.h 2010-02-11 06:17:35.0, 0100 |
| Line 169 in Socket.h | Line 169 in Socket.h |
virtual int Close(); /** Add file descriptor to sockethandler fd_set's. */ void Set(bool bRead,bool bWrite,bool bException = true); /** Returns true when socket file descriptor is valid and socket is not about to be closed. */ | |
SocketHandler.cpp | |
| /usr/src/Sockets-2.3.9.1/SocketHandler.cpp 2010-02-09 21:16:32.0, 0100 | /usr/src/Sockets-2.3.9.2/SocketHandler.cpp 2010-03-18 12:13:43.0, 0100 |
| Line 225 in SocketHandler.cpp | Line 225 in SocketHandler.cpp |
void SocketHandler::Get(SOCKET s,bool& r,bool& w,bool& e) { if (s >= 0) { r = FD_ISSET(s, &m_rfds) ? true : false; w = FD_ISSET(s, &m_wfds) ? true : false; e = FD_ISSET(s, &m_efds) ? true : false; } } void SocketHandler::Set(SOCKET s,bool bRead,bool bWrite,bool bException) { DEB( fprintf(stderr, "Set(%d, %s, %s, %s)\n", s, bRead ? "true" : "false", bWrite ? "true" : "false", bException ? "true" : "false");) if (s >= 0) { if (bRead) { | void SocketHandler::ISocketHandler_Add(Socket *p,bool bRead,bool bWrite) { Set(p, bRead, bWrite); } void SocketHandler::ISocketHandler_Mod(Socket *p,bool bRead,bool bWrite) { Set(p, bRead, bWrite); } void SocketHandler::ISocketHandler_Del(Socket *p) { Set(p, false, false); } void SocketHandler::Set(Socket *p,bool bRead,bool bWrite) { SOCKET s = p -> GetSocket(); if (s >= 0) { bool bException = true; if (bRead) { |
| Line 663 in SocketHandler.cpp | Line 671 in SocketHandler.cpp |
while (m_add.size() > 0) { if (m_sockets.size() >= FD_SETSIZE) { LogError(NULL, "Select", (int)m_sockets.size(), "FD_SETSIZE reached", LOG_LEVEL_WARNING); break; } | while (m_add.size() > 0) { if (m_sockets.size() >= MaxCount()) { LogError(NULL, "Select", (int)m_sockets.size(), "socket limit reached", LOG_LEVEL_WARNING); break; } |
| Line 714 in SocketHandler.cpp | Line 722 in SocketHandler.cpp |
if (scp && scp -> Connecting()) // 'Open' called before adding socket { Set(s,false,true); } else | if (scp && scp -> Connecting()) // 'Open' called before adding socket { ISocketHandler_Add(p,false,true); } else |
| Line 722 in SocketHandler.cpp | Line 730 in SocketHandler.cpp |
if (p -> IsDisableRead()) { Set(s, false, bWrite); } else { Set(s, true, bWrite); } } | if (p -> IsDisableRead()) { ISocketHandler_Add(p, false, bWrite); } else { ISocketHandler_Add(p, true, bWrite); } } |
| Line 842 in SocketHandler.cpp | Line 850 in SocketHandler.cpp |
if (p -> IsDetach()) { Set(p -> GetSocket(), false, false, false); // After DetachSocket(), all calls to Handler() will return a reference // to the new slave SocketHandler running in the new thread. | if (p -> IsDetach()) { ISocketHandler_Del(p); // After DetachSocket(), all calls to Handler() will return a reference // to the new slave SocketHandler running in the new thread. |
| Line 922 in SocketHandler.cpp | Line 930 in SocketHandler.cpp |
{ TcpSocket *tcp = dynamic_cast<TcpSocket *>(p); if (p -> Lost()) { DeleteSocket(p); } | { TcpSocket *tcp = dynamic_cast<TcpSocket *>(p); if (p -> Lost() && !(tcp && tcp -> Reconnect())) { // remove instance when Lost, if not reconnect flag is set DeleteSocket(p); } |
| Line 951 in SocketHandler.cpp | Line 960 in SocketHandler.cpp |
else { Set(p -> GetSocket(),false,false,false); tcp -> Close(); DeleteSocket(p); | else { ISocketHandler_Del(p); tcp -> Close(); DeleteSocket(p); |
| Line 998 in SocketHandler.cpp | Line 1007 in SocketHandler.cpp |
#endif // ENABLE_POOL { Set(p -> GetSocket(),false,false,false); DEB( fprintf(stderr, "Close() before OnDelete\n");) p -> Close(); | #endif // ENABLE_POOL { ISocketHandler_Del(p); DEB( fprintf(stderr, "Close() before OnDelete\n");) p -> Close(); |
| Line 1010 in SocketHandler.cpp | Line 1019 in SocketHandler.cpp |
int SocketHandler::Select(long sec,long usec) { struct timeval tv; tv.tv_sec = sec; tv.tv_usec = usec; return Select(&tv); } int SocketHandler::Select() { if (m_b_check_callonconnect || m_b_check_detach || m_b_check_timeout || m_b_check_retry || m_b_check_close) { return Select(0, 200000); } return Select(NULL); } int SocketHandler::Select(struct timeval *tsel) { if (!m_add.empty()) { AddIncoming(); } #ifdef MACOSX fd_set rfds; | int SocketHandler::ISocketHandler_Select(struct timeval *tsel) { #ifdef MACOSX fd_set rfds; |
| Line 1151 in SocketHandler.cpp | Line 1133 in SocketHandler.cpp |
} // m_sockets ... } // if (n > 0) return n; } int SocketHandler::Select(long sec,long usec) { struct timeval tv; tv.tv_sec = sec; tv.tv_usec = usec; return Select(&tv); } int SocketHandler::Select() { if (m_b_check_callonconnect || m_b_check_detach || m_b_check_timeout || m_b_check_retry || m_b_check_close) { return Select(0, 200000); } return Select(NULL); } int SocketHandler::Select(struct timeval *tsel) { if (!m_add.empty()) { AddIncoming(); } int n = ISocketHandler_Select(tsel); // check CallOnConnect - EVENT if (m_b_check_callonconnect) | |
SocketHandler.h | |
| /usr/src/Sockets-2.3.9.1/SocketHandler.h 2010-02-09 21:16:33.0, 0100 | /usr/src/Sockets-2.3.9.2/SocketHandler.h 2010-03-18 12:07:32.0, 0100 |
| Line 84 in SocketHandler.h | Line 84 in SocketHandler.h |
void Add(Socket *); /** Get status of read/write/exception file descriptor set for a socket. */ void Get(SOCKET s,bool& r,bool& w,bool& e); /** Set read/write/exception file descriptor sets (fd_set). */ void Set(SOCKET s,bool bRead,bool bWrite,bool bException = true); /** Wait for events, generate callbacks. */ | void Add(Socket *); /** Set read/write/exception file descriptor sets (fd_set). */ void ISocketHandler_Add(Socket *,bool bRead,bool bWrite); void ISocketHandler_Mod(Socket *,bool bRead,bool bWrite); void ISocketHandler_Del(Socket *); /** Wait for events, generate callbacks. */ |
| Line 105 in SocketHandler.h | Line 104 in SocketHandler.h |
/** Return number of sockets handled by this handler. */ size_t GetCount(); size_t MaxCount() { return FD_SETSIZE; } /** Override and return false to deny all incoming connections. | |
| Line 199 in SocketHandler.h | Line 199 in SocketHandler.h |
protected: /** Remove socket from socket map, used by Socket class. */ void Remove(Socket *); StdLog *m_stdlog; ///< Registered log class, or NULL IMutex& m_mutex; ///< Thread safety mutex bool m_b_use_mutex; ///< Mutex correctly initialized private: /** Schedule socket for deletion */ void DeleteSocket(Socket *); void RebuildFdset(); void AddIncoming(); void CheckErasedSockets(); | protected: /** Actual call to select() */ int ISocketHandler_Select(struct timeval *); /** Remove socket from socket map, used by Socket class. */ void Remove(Socket *); /** Schedule socket for deletion */ void DeleteSocket(Socket *); void AddIncoming(); void CheckErasedSockets(); |
| Line 216 in SocketHandler.h | Line 212 in SocketHandler.h |
void CheckRetry(); void CheckClose(); // StdLog *m_stdlog; ///< Registered log class, or NULL IMutex& m_mutex; ///< Thread safety mutex bool m_b_use_mutex; ///< Mutex correctly initialized private: void RebuildFdset(); void Set(Socket *,bool,bool); // SOCKET m_maxsock; ///< Highest file descriptor + 1 in active sockets list | |
TcpSocket.cpp | |
| /usr/src/Sockets-2.3.9.1/TcpSocket.cpp 2010-02-09 21:17:00.0, 0100 | /usr/src/Sockets-2.3.9.2/TcpSocket.cpp 2010-02-14 09:48:25.0, 0100 |
| Line 213 in TcpSocket.cpp | Line 213 in TcpSocket.cpp |
return false; } if (Handler().GetCount() >= FD_SETSIZE) { Handler().LogError(this, "Open", 0, "no space left in fd_set", LOG_LEVEL_FATAL); SetCloseAndDelete(); return false; | return false; } if (Handler().GetCount() >= Handler().MaxCount()) { Handler().LogError(this, "Open", 0, "no space left for more sockets", LOG_LEVEL_FATAL); SetCloseAndDelete(); return false; |
| Line 680 in TcpSocket.cpp | Line 680 in TcpSocket.cpp |
if (!err) // ok { Set(!IsDisableRead(), false); SetConnecting(false); SetCallOnConnect(); | if (!err) // ok { Handler().ISocketHandler_Mod(this, !IsDisableRead(), false); SetConnecting(false); SetCallOnConnect(); |
| Line 686 in TcpSocket.cpp | Line 686 in TcpSocket.cpp |
} Handler().LogError(this, "tcp: connect failed", err, StrError(err), LOG_LEVEL_FATAL); Set(false, false); // no more monitoring because connection failed // failed | } Handler().LogError(this, "tcp: connect failed", err, StrError(err), LOG_LEVEL_FATAL); Handler().ISocketHandler_Mod(this, false, false); // no more monitoring because connection failed // failed |
| Line 764 in TcpSocket.cpp | Line 764 in TcpSocket.cpp |
// check output buffer set, set/reset m_wfds accordingly { bool br; bool bw; bool bx; Handler().Get(GetSocket(), br, bw, bx); if (m_obuf.size()) Set(br, true); else Set(br, false); } } | // check output buffer set, set/reset m_wfds accordingly { bool br = !IsDisableRead(); if (m_obuf.size()) Handler().ISocketHandler_Mod(this, br, true); else Handler().ISocketHandler_Mod(this, br, false); } } |
| Line 938 in TcpSocket.cpp | Line 935 in TcpSocket.cpp |
// check output buffer set, set/reset m_wfds accordingly { bool br; bool bw; bool bx; Handler().Get(GetSocket(), br, bw, bx); if (m_obuf.size()) Set(br, true); else Set(br, false); } } | // check output buffer set, set/reset m_wfds accordingly { bool br = !IsDisableRead(); if (m_obuf.size()) Handler().ISocketHandler_Mod(this, br, true); else Handler().ISocketHandler_Mod(this, br, false); } } |
| Line 1290 in TcpSocket.cpp | Line 1284 in TcpSocket.cpp |
if (m_client_contexts.find(context) == m_client_contexts.end()) { SSL_METHOD *meth = meth_in ? const_cast<SSL_METHOD *>(meth_in) : SSLv3_method(); m_ssl_ctx = m_client_contexts[context] = SSL_CTX_new(meth); SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY|SSL_MODE_ENABLE_PARTIAL_WRITE); | if (m_client_contexts.find(context) == m_client_contexts.end()) { SSL_METHOD *meth = const_cast<SSL_METHOD *>(meth_in) ? const_cast<SSL_METHOD *>(meth_in) : const_cast<SSL_METHOD *>(SSLv3_method()); m_ssl_ctx = m_client_contexts[context] = SSL_CTX_new(meth); SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY|SSL_MODE_ENABLE_PARTIAL_WRITE); |