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 |
Ajp13Socket.cpp | |
| /usr/src/Sockets-2.3.9.2/Ajp13Socket.cpp 2010-02-09 21:13:42.0, 0100 | /usr/src/Sockets-2.3.9.3/Ajp13Socket.cpp 2010-07-08 16:02:50.0, 0200 |
| Line 60 in Ajp13Socket.cpp | Line 60 in Ajp13Socket.cpp |
if (id != 0x1234) { fprintf(stderr, "ABORT: bad packet id: %x\n", id); SetCloseAndDelete(); } | if (id != 0x1234) { DEB( fprintf(stderr, "ABORT: bad packet id: %x\n", id);) SetCloseAndDelete(); } |
| Line 75 in Ajp13Socket.cpp | Line 75 in Ajp13Socket.cpp |
if (sz - 2 > m_body_size_left) { fprintf(stderr, "More body data received than expected\n"); SetCloseAndDelete(); return; | if (sz - 2 > m_body_size_left) { DEB( fprintf(stderr, "More body data received than expected\n");) SetCloseAndDelete(); return; |
| Line 165 in Ajp13Socket.cpp | Line 165 in Ajp13Socket.cpp |
else { fprintf(stderr, "Unknown header key value: %x\n", x); SetCloseAndDelete(); } | else { DEB( fprintf(stderr, "Unknown header key value: %x\n", x);) SetCloseAndDelete(); } |
| Line 202 in Ajp13Socket.cpp | Line 202 in Ajp13Socket.cpp |
else { fprintf(stderr, "Unknown attribute key: 0x%02x\n", buf[ptr]); SetCloseAndDelete(); } | else { DEB( fprintf(stderr, "Unknown attribute key: 0x%02x\n", buf[ptr]);) SetCloseAndDelete(); } |
| Line 401 in Ajp13Socket.cpp | Line 401 in Ajp13Socket.cpp |
break; default: fprintf(stderr, "Unknown packet type: 0x%02x\n", *buf); SetCloseAndDelete(); } | break; default: DEB( fprintf(stderr, "Unknown packet type: 0x%02x\n", *buf);) SetCloseAndDelete(); } |
Base64.cpp | |
| /usr/src/Sockets-2.3.9.2/Base64.cpp 2010-02-09 21:13:47.0, 0100 | /usr/src/Sockets-2.3.9.3/Base64.cpp 2010-07-14 13:58:32.0, 0200 |
| Line 31 in Base64.cpp | Line 31 in Base64.cpp |
*/ #include "Base64.h" #include "IFile.h" #ifdef SOCKETS_NAMESPACE | |
| Line 59 in Base64.cpp | Line 60 in Base64.cpp |
void Base64::encode(IFile *fil, std::string& output, bool add_crlf) { size_t remain; size_t i = 0; size_t o = 0; char input[4]; output = ""; remain = fil -> fread(input,1,3); while (remain > 0) { if (add_crlf && o && o % 76 == 0) output += "\n"; switch (remain) { case 1: output += bstr[ ((input[i] >> 2) & 0x3f) ]; output += bstr[ ((input[i] << 4) & 0x30) ]; output += "=="; break; case 2: output += bstr[ ((input[i] >> 2) & 0x3f) ]; output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; output += "="; break; default: output += bstr[ ((input[i] >> 2) & 0x3f) ]; output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; output += bstr[ (input[i + 2] & 0x3f) ]; } o += 4; // remain = fil -> fread(input,1,3); } } void Base64::encode(FILE *fil, std::string& output, bool add_crlf) { | |
Base64.h | |
| /usr/src/Sockets-2.3.9.2/Base64.h 2010-02-09 21:13:48.0, 0100 | /usr/src/Sockets-2.3.9.3/Base64.h 2010-07-14 13:58:21.0, 0200 |
| Line 45 in Base64.h | Line 45 in Base64.h |
#endif class IFile; /** \defgroup util Utilities */ | |
| Line 55 in Base64.h | Line 57 in Base64.h |
void encode(FILE *, std::string& , bool add_crlf = true); void encode(IFile *, std::string& , bool add_crlf = true); void encode(const std::string&, std::string& , bool add_crlf = true); void encode(const char *, size_t, std::string& , bool add_crlf = true); | |
Changelog | |
| /usr/src/Sockets-2.3.9.2/Changelog 2010-03-18 12:13:08.0, 0100 | /usr/src/Sockets-2.3.9.3/Changelog 2010-07-14 16:12:34.0, 0200 |
| 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.3 -------- Added multithread support in sockethandler. New method SetNumberOfThreads() enables this. New method in sockethandler: Release(). Make select() release before specified timeout. Enable function with method EnableRelease(). EventHandler using new release functionality. Thread startup controlled with semaphore instead of flag/sleep combo. Default thread startup behaviour is run at once, optional is wait until released by posting to semaphore (via method SetRelease(true)). Adding a socket with closeanddelete flag set now works as expected. Added platform independent method Utility::Sleep( milliseconds ). Added missing win32 implementation in new sockethandler. Added win32 implementation of Semaphore. Repaired build for cygwin/mingw/devcpp. 2.3.9.2 -------- | |
Debug.cpp | |
| /usr/src/Sockets-2.3.9.2/Debug.cpp 2010-02-09 20:47:42.0, 0100 | /usr/src/Sockets-2.3.9.3/Debug.cpp 2010-07-14 13:40:49.0, 0200 |
| Line 34 in Debug.cpp | Line 34 in Debug.cpp |
va_start(ap, format); #ifdef _WIN32 vsprintf_s(slask, sizeof(slask), format, ap); #else vsnprintf(slask, sizeof(slask), format, ap); #endif va_end(ap); | |
EventHandler.cpp | |
| /usr/src/Sockets-2.3.9.2/EventHandler.cpp 2010-02-09 21:13:55.0, 0100 | /usr/src/Sockets-2.3.9.3/EventHandler.cpp 2010-03-23 18:26:04.0, 0100 |
| Line 45 in EventHandler.cpp | Line 45 in EventHandler.cpp |
EventHandler::EventHandler(StdLog *p) : SocketHandler(p), m_quit(false), m_socket(NULL) { } EventHandler::EventHandler(IMutex& m,StdLog *p) : SocketHandler(m, p), m_quit(false), m_socket(NULL) { } | EventHandler::EventHandler(StdLog *p) : SocketHandler(p), m_quit(false) { EnableRelease(); } EventHandler::EventHandler(IMutex& m,StdLog *p) : SocketHandler(m, p), m_quit(false) { EnableRelease(); } |
| Line 129 in EventHandler.cpp | Line 131 in EventHandler.cpp |
} m_events.insert(it, e); if (m_socket) { m_socket -> Send("\n"); } return e -> GetID(); } | } m_events.insert(it, e); Release(); return e -> GetID(); } |
| Line 199 in EventHandler.cpp | Line 198 in EventHandler.cpp |
void EventHandler::Add(Socket *p) { if (!m_socket) { ListenSocket<TcpSocket> *l = new ListenSocket<TcpSocket>(*this); l -> SetDeleteByHandler(); l -> Bind("127.0.0.1", 0); m_port = l -> GetPort(); SocketHandler::Add(l); m_socket = new TcpSocket( *this ); m_socket -> SetDeleteByHandler(); m_socket -> SetConnectTimeout(5); m_socket -> SetConnectionRetry(-1); #ifdef ENABLE_RECONNECT m_socket -> SetReconnect(true); #endif m_socket -> Open("127.0.0.1", m_port); SocketHandler::Add(m_socket); } SocketHandler::Add( p ); } | |
EventHandler.h | |
| /usr/src/Sockets-2.3.9.2/EventHandler.h 2010-02-09 21:13:56.0, 0100 | /usr/src/Sockets-2.3.9.3/EventHandler.h 2010-03-23 18:24:55.0, 0100 |
| Line 74 in EventHandler.h | Line 74 in EventHandler.h |
std::list<Event *> m_events; bool m_quit; TcpSocket *m_socket; port_t m_port; }; | |
File.cpp | |
| /usr/src/Sockets-2.3.9.2/File.cpp 2010-02-09 21:14:01.0, 0100 | /usr/src/Sockets-2.3.9.3/File.cpp 2010-07-14 13:51:27.0, 0200 |
| Line 68 in File.cpp | Line 68 in File.cpp |
m_path = path; m_mode = mode; #ifdef _WIN32 if (fopen_s(&m_fil, path.c_str(), mode.c_str())) m_fil = NULL; | m_path = path; m_mode = mode; #if defined( _WIN32) && !defined(__CYGWIN__) if (fopen_s(&m_fil, path.c_str(), mode.c_str())) m_fil = NULL; |
HttpClientSocket.cpp | |
| /usr/src/Sockets-2.3.9.2/HttpClientSocket.cpp 2010-02-09 21:14:07.0, 0100 | /usr/src/Sockets-2.3.9.3/HttpClientSocket.cpp 2010-07-14 13:50:44.0, 0200 |
| Line 37 in HttpClientSocket.cpp | Line 37 in HttpClientSocket.cpp |
#include "StdLog.h" #include "ISocketHandler.h" #include "File.h" | |
| Line 101 in HttpClientSocket.cpp | Line 102 in HttpClientSocket.cpp |
if (m_fil) { fclose(m_fil); } } | if (m_fil) { m_fil -> fclose(); } } |
| Line 136 in HttpClientSocket.cpp | Line 137 in HttpClientSocket.cpp |
if (m_filename.size()) { #ifdef _WIN32 if (fopen_s(&m_fil, m_filename.c_str(), "wb")) m_fil = NULL; #else m_fil = fopen(m_filename.c_str(), "wb"); #endif } else | if (m_filename.size()) { m_fil = new File; if (!m_fil -> fopen(m_filename, "wb")) { delete m_fil; m_fil = NULL; } } else |
| Line 156 in HttpClientSocket.cpp | Line 157 in HttpClientSocket.cpp |
if (m_fil) { fwrite(buf, 1, len, m_fil); } else | if (m_fil) { m_fil -> fwrite(buf, 1, len); } else |
| Line 175 in HttpClientSocket.cpp | Line 176 in HttpClientSocket.cpp |
if (m_fil) { fclose(m_fil); m_fil = NULL; } | if (m_fil) { m_fil -> fclose(); delete m_fil; m_fil = NULL; } |
| Line 194 in HttpClientSocket.cpp | Line 196 in HttpClientSocket.cpp |
if (m_fil) { fclose(m_fil); m_fil = NULL; } | if (m_fil) { m_fil -> fclose(); delete m_fil; m_fil = NULL; } |
HttpClientSocket.h | |
| /usr/src/Sockets-2.3.9.2/HttpClientSocket.h 2010-02-09 21:14:08.0, 0100 | /usr/src/Sockets-2.3.9.3/HttpClientSocket.h 2010-07-14 13:44:47.0, 0200 |
| Line 41 in HttpClientSocket.h | Line 41 in HttpClientSocket.h |
#endif class IFile; /** Get http response to file or memory. \ingroup http */ | |
| Line 112 in HttpClientSocket.h | Line 114 in HttpClientSocket.h |
std::string m_content; ///< Received http headers bool m_data_ptr_set; ///< Buffer set from outside, do not delete FILE *m_fil; ///< Output file size_t m_content_ptr; ///< Number of bytes received from body bool m_b_complete; ///< The entire content-length number of bytes has been received | std::string m_content; ///< Received http headers bool m_data_ptr_set; ///< Buffer set from outside, do not delete IFile *m_fil; ///< Output file size_t m_content_ptr; ///< Number of bytes received from body bool m_b_complete; ///< The entire content-length number of bytes has been received |
HttpdCookies.cpp | |
| /usr/src/Sockets-2.3.9.2/HttpdCookies.cpp 2010-02-09 21:14:09.0, 0100 | /usr/src/Sockets-2.3.9.3/HttpdCookies.cpp 2010-07-14 14:05:34.0, 0200 |
| Line 232 in HttpdCookies.cpp | Line 232 in HttpdCookies.cpp |
const std::string& HttpdCookies::expiredatetime() const { time_t t = time(NULL); struct tm tp; #ifdef _WIN32 gmtime_s(&tp, &t); #else gmtime_r(&t, &tp); #endif const char *days[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; | |
| Line 245 in HttpdCookies.cpp | Line 238 in HttpdCookies.cpp |
char dt[100]; time_t t = time(NULL); #ifdef __CYGWIN__ struct tm *tp = gmtime(&t); snprintf(dt, sizeof(dt), "%s, %02d-%s-%04d %02d:%02d:%02d GMT", days[tp -> tm_wday], tp -> tm_mday, months[tp -> tm_mon], tp -> tm_year + 1910, tp -> tm_hour, tp -> tm_min, tp -> tm_sec); #else struct tm tp; #if defined( _WIN32) && !defined(__CYGWIN__) gmtime_s(&tp, &t); #else gmtime_r(&t, &tp); #endif snprintf(dt, sizeof(dt), "%s, %02d-%s-%04d %02d:%02d:%02d GMT", days[tp.tm_wday], | |
| Line 253 in HttpdCookies.cpp | Line 264 in HttpdCookies.cpp |
tp.tm_min, tp.tm_sec); #endif m_date = dt; return m_date; | |
HttpdForm.cpp | |
| /usr/src/Sockets-2.3.9.2/HttpdForm.cpp 2010-02-09 21:14:13.0, 0100 | /usr/src/Sockets-2.3.9.3/HttpdForm.cpp 2010-07-14 14:10:43.0, 0200 |
| Line 40 in HttpdForm.cpp | Line 40 in HttpdForm.cpp |
#include "IFileUpload.h" #include "IStream.h" #include "File.h" #ifdef SOCKETS_NAMESPACE | |
| Line 211 in HttpdForm.cpp | Line 212 in HttpdForm.cpp |
{ // read until m_strBoundary... FILE *fil = NULL; int out = 0; char c; | { // read until m_strBoundary... IFile *fil = NULL; int out = 0; char c; |
| Line 221 in HttpdForm.cpp | Line 222 in HttpdForm.cpp |
if (tmp_path[strlen(tmp_path) - 1] != '\\') { #ifdef __CYGWIN__ strcat(tmp_path, "\\"); #else strcat_s(tmp_path, sizeof(tmp_path), "\\"); #endif } snprintf(fn,sizeof(fn),"%s%s",tmp_path,current_filename.c_str()); | |
| Line 232 in HttpdForm.cpp | Line 237 in HttpdForm.cpp |
else { #ifdef _WIN32 if (fopen_s(&fil, fn, "wb")) fil = NULL; #else fil = fopen(fn, "wb"); #endif } if (fil || m_upload_stream) | else { fil = new File; if (!fil -> fopen(fn, "wb")) { delete fil; fil = NULL; } } if (fil || m_upload_stream) |
| Line 250 in HttpdForm.cpp | Line 255 in HttpdForm.cpp |
m_upload_stream -> IStreamWrite(&tempcmp[tc], 1); else fwrite(&tempcmp[tc],1,1,fil); } tempcmp[tc] = c; | m_upload_stream -> IStreamWrite(&tempcmp[tc], 1); else fil -> fwrite(&tempcmp[tc],1,1); } tempcmp[tc] = c; |
| Line 285 in HttpdForm.cpp | Line 290 in HttpdForm.cpp |
if (fil) { fclose(fil); } | if (fil) { fil -> fclose(); delete fil; } |
| Line 291 in HttpdForm.cpp | Line 297 in HttpdForm.cpp |
m_cgi.push_back(cgi); #ifdef _WIN32 strcpy_s(slask, TMPSIZE, m_strBoundary.c_str()); #else | m_cgi.push_back(cgi); #if defined( _WIN32) && !defined(__CYGWIN__) strcpy_s(slask, TMPSIZE, m_strBoundary.c_str()); #else |
HttpdSocket.cpp | |
| /usr/src/Sockets-2.3.9.2/HttpdSocket.cpp 2010-02-09 21:14:15.0, 0100 | /usr/src/Sockets-2.3.9.3/HttpdSocket.cpp 2010-07-14 14:05:13.0, 0200 |
| Line 256 in HttpdSocket.cpp | Line 256 in HttpdSocket.cpp |
{ time_t t = time(NULL); struct tm tp; #ifdef _WIN32 localtime_s(&tp, &t); #else localtime_r(&t, &tp); #endif char slask[40]; // yyyy-mm-dd hh:mm:ss snprintf(slask,sizeof(slask),"%d-%02d-%02d %02d:%02d:%02d", tp.tm_year + 1900, | { time_t t = time(NULL); char slask[40]; // yyyy-mm-dd hh:mm:ss #ifdef __CYGWIN__ struct tm *tp = localtime(&t); snprintf(slask,sizeof(slask),"%d-%02d-%02d %02d:%02d:%02d", tp -> tm_year + 1900, tp -> tm_mon + 1, tp -> tm_mday, tp -> tm_hour,tp -> tm_min,tp -> tm_sec); #else struct tm tp; #if defined( _WIN32) && !defined(__CYGWIN__) localtime_s(&tp, &t); #else localtime_r(&t, &tp); #endif snprintf(slask,sizeof(slask),"%d-%02d-%02d %02d:%02d:%02d", tp.tm_year + 1900, |
| Line 268 in HttpdSocket.cpp | Line 276 in HttpdSocket.cpp |
tp.tm_mday, tp.tm_hour,tp.tm_min,tp.tm_sec); #endif return slask; } | |
HttpPostSocket.cpp | |
| /usr/src/Sockets-2.3.9.2/HttpPostSocket.cpp 2010-02-09 21:14:20.0, 0100 | /usr/src/Sockets-2.3.9.3/HttpPostSocket.cpp 2010-07-14 13:53:43.0, 0200 |
| Line 43 in HttpPostSocket.cpp | Line 43 in HttpPostSocket.cpp |
#include <sys/stat.h> #include "Lock.h" #include "File.h" #include "HttpPostSocket.h" | |
| Line 261 in HttpPostSocket.cpp | Line 262 in HttpPostSocket.cpp |
Send( tmp ); { #ifdef _WIN32 FILE *fil; if (fopen_s(&fil, filename.c_str(), "rb")) fil = NULL; #else FILE *fil = fopen(filename.c_str(),"rb"); #endif if (fil) { char slask[2000]; // for fread size_t n; while ((n = fread(slask, 1, 2000, fil)) > 0) { SendBuf(slask, n); } fclose(fil); } } | Send( tmp ); { std::auto_ptr<IFile> fil = std::auto_ptr<IFile>(new File); if (fil -> fopen(filename, "rb")) { char slask[2000]; // for fread size_t n; while ((n = fil -> fread(slask, 1, 2000)) > 0) { SendBuf(slask, n); } fil -> fclose(); } } |
HttpPutSocket.cpp | |
| /usr/src/Sockets-2.3.9.2/HttpPutSocket.cpp 2010-02-09 21:14:22.0, 0100 | /usr/src/Sockets-2.3.9.3/HttpPutSocket.cpp 2010-07-14 13:55:41.0, 0200 |
| Line 40 in HttpPutSocket.cpp | Line 40 in HttpPutSocket.cpp |
#include <sys/types.h> #include <sys/stat.h> #include "File.h" #include "HttpPutSocket.h" | |
| Line 104 in HttpPutSocket.cpp | Line 105 in HttpPutSocket.cpp |
SendRequest(); #ifdef _WIN32 FILE *fil; if (fopen_s(&fil, m_filename.c_str(), "rb")) fil = NULL; #else FILE *fil = fopen(m_filename.c_str(), "rb"); #endif if (fil) { size_t n; char buf[32768]; while ((n = fread(buf, 1, 32768, fil)) > 0) { SendBuf(buf, n); } fclose(fil); } } | SendRequest(); std::auto_ptr<IFile> fil = std::auto_ptr<IFile>(new File); if (fil -> fopen(m_filename, "rb")) { size_t n; char buf[32768]; while ((n = fil -> fread(buf, 1, 32768)) > 0) { SendBuf(buf, n); } fil -> fclose(); } } |
HttpResponse.cpp | |
| /usr/src/Sockets-2.3.9.2/HttpResponse.cpp 2010-02-09 21:14:26.0, 0100 | /usr/src/Sockets-2.3.9.3/HttpResponse.cpp 2010-07-14 13:40:53.0, 0200 |
| Line 196 in HttpResponse.cpp | Line 196 in HttpResponse.cpp |
va_start(ap, format); char tmp[10000]; #ifdef _WIN32 vsprintf_s(tmp, sizeof(tmp), format, ap); #else vsnprintf(tmp, sizeof(tmp), format, ap); #endif va_end(ap); m_file -> fwrite( tmp, 1, strlen(tmp) ); | |
HTTPSocket.cpp | |
| /usr/src/Sockets-2.3.9.2/HTTPSocket.cpp 2010-02-09 21:14:28.0, 0100 | /usr/src/Sockets-2.3.9.3/HTTPSocket.cpp 2010-07-14 13:40:59.0, 0200 |
| Line 299 in HTTPSocket.cpp | Line 299 in HTTPSocket.cpp |
va_start(ap, format); #ifdef _WIN32 vsprintf_s(slask, sizeof(slask), format, ap); #else vsnprintf(slask, sizeof(slask), format, ap); #endif va_end(ap); | |
Ipv6Address.cpp | |
| /usr/src/Sockets-2.3.9.2/Ipv6Address.cpp 2010-02-09 21:15:10.0, 0100 | /usr/src/Sockets-2.3.9.3/Ipv6Address.cpp 2010-07-14 14:10:47.0, 0200 |
| Line 167 in Ipv6Address.cpp | Line 167 in Ipv6Address.cpp |
if (*slask && (x || !ok_to_skip || prev)) { #ifdef _WIN32 strcat_s(slask,sizeof(slask),":"); #else | if (*slask && (x || !ok_to_skip || prev)) { #if defined( _WIN32) && !defined(__CYGWIN__) strcat_s(slask,sizeof(slask),":"); #else |
ISocketHandler.h | |
| /usr/src/Sockets-2.3.9.2/ISocketHandler.h 2010-03-18 12:07:06.0, 0100 | /usr/src/Sockets-2.3.9.3/ISocketHandler.h 2010-07-14 14:43:06.0, 0200 |
| Line 79 in ISocketHandler.h | Line 79 in ISocketHandler.h |
virtual ~ISocketHandler() {} /** Return another instance */ virtual ISocketHandler *Create(StdLog * = NULL) = 0; /** Return another instance */ virtual ISocketHandler *Create(IMutex&, ISocketHandler&, StdLog * = NULL) = 0; /** Handler created with parent */ virtual bool ParentHandlerIsValid() = 0; /** Get parent sockethandler */ virtual ISocketHandler& ParentHandler() = 0; /** Get thread handler with least connections */ virtual ISocketHandler& GetRandomHandler() = 0; /** Return parent handler if valid, otherwise return normal handler */ virtual ISocketHandler& GetEffectiveHandler() = 0; /** Enable threading */ virtual void SetNumberOfThreads(size_t n) = 0; /** Threading is enabled */ virtual bool IsThreaded() = 0; /** Enable select release */ virtual void EnableRelease() = 0; /** Make select release */ virtual void Release() = 0; /** Get mutex reference for threadsafe operations. */ virtual IMutex& GetMutex() const = 0; | |
ListenSocket.h | |
| /usr/src/Sockets-2.3.9.2/ListenSocket.h 2010-03-18 12:07:15.0, 0100 | /usr/src/Sockets-2.3.9.3/ListenSocket.h 2010-07-14 14:43:15.0, 0200 |
| Line 49 in ListenSocket.h | Line 49 in ListenSocket.h |
#include "Exception.h" #endif #include "Lock.h" #ifdef SOCKETS_NAMESPACE | |
| Line 354 in ListenSocket.h | Line 355 in ListenSocket.h |
return; } Socket *tmp = m_bHasCreate ? m_creator -> Create() : new X(Handler()); #ifdef ENABLE_IPV6 tmp -> SetIpv6( IsIpv6() ); | return; } // Socket *tmp = NULL; if (Handler().IsThreaded()) { ISocketHandler& h = Handler().GetRandomHandler(); tmp = new X(h); // %! no support for Create #ifdef ENABLE_IPV6 tmp -> SetIpv6( IsIpv6() ); |
| Line 361 in ListenSocket.h | Line 367 in ListenSocket.h |
tmp -> Attach(a_s); tmp -> SetNonblocking(true); { #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 | |
| Line 388 in ListenSocket.h | Line 393 in ListenSocket.h |
} } tmp -> SetConnected(true); tmp -> Init(); tmp -> SetDeleteByHandler(true); { Lock lock(h.GetMutex()); h.Add(tmp); #ifdef HAVE_OPENSSL if (tmp -> IsSSL()) // SSL Enabled socket { // %! OnSSLAccept calls SSLNegotiate that can finish in this one call. // %! If that happens and negotiation fails, the 'tmp' instance is // %! still added to the list of active sockets in the sockethandler. // %! See bugfix for this in SocketHandler::Select - don't Set rwx // %! flags if CloseAndDelete() flag is true. // %! An even better fugbix (see TcpSocket::OnSSLAccept) now avoids // %! the Add problem altogether, so ignore the above. // %! (OnSSLAccept does no longer call SSLNegotiate().) tmp -> OnSSLAccept(); } else #endif { tmp -> OnAccept(); } } h.Release(); } else { tmp = m_bHasCreate ? m_creator -> Create() : new X(Handler()); #ifdef ENABLE_IPV6 tmp -> SetIpv6( IsIpv6() ); #endif tmp -> SetParent(this); tmp -> Attach(a_s); tmp -> SetNonblocking(true); #ifdef ENABLE_IPV6 #ifdef IPPROTO_IPV6 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); } } #endif #endif if (sa_len == sizeof(struct sockaddr_in)) { struct sockaddr_in *p = (struct sockaddr_in *)&sa; if (p -> sin_family == AF_INET) { Ipv4Address ad(p -> sin_addr,ntohs(p -> sin_port)); tmp -> SetRemoteAddress(ad); } } tmp -> SetConnected(true); | |
| Line 411 in ListenSocket.h | Line 477 in ListenSocket.h |
tmp -> OnAccept(); } } } // while (true) } | |
Makefile.version | |
| /usr/src/Sockets-2.3.9.2/Makefile.version 2010-03-18 12:04:36.0, 0100 | /usr/src/Sockets-2.3.9.3/Makefile.version 2010-07-14 12:36:44.0, 0200 |
| Line 1 in Makefile.version | Line 1 in Makefile.version |
MAJOR = 2 MINOR = 3.9.2 VERSION = $(MAJOR).$(MINOR) DIFF_VERSION = 2.3.9.1 # Sockets | MAJOR = 2 MINOR = 3.9.3 VERSION = $(MAJOR).$(MINOR) DIFF_VERSION = 2.3.9.2 # Sockets |
| Line 44 in Makefile.version | Line 44 in Makefile.version |
SocketHandler.o \ SocketHandlerEp.o \ SocketHandlerThread.o \ SocketStream.o \ SocketThread.o \ StdoutLog.o \ StreamSocket.o \ | |
MemFile.cpp | |
| /usr/src/Sockets-2.3.9.2/MemFile.cpp 2010-02-09 21:15:44.0, 0100 | /usr/src/Sockets-2.3.9.3/MemFile.cpp 2010-07-14 13:41:02.0, 0200 |
| Line 286 in MemFile.cpp | Line 286 in MemFile.cpp |
char tmp[BLOCKSIZE]; va_start(ap, format); #ifdef _WIN32 vsprintf_s(tmp, sizeof(tmp), format, ap); #else vsnprintf(tmp, sizeof(tmp), format, ap); #endif va_end(ap); fwrite(tmp, 1, strlen(tmp)); | |
Semaphore.cpp | |
| /usr/src/Sockets-2.3.9.2/Semaphore.cpp 2010-02-09 21:16:23.0, 0100 | /usr/src/Sockets-2.3.9.3/Semaphore.cpp 2010-07-14 16:05:30.0, 0200 |
| Line 39 in Semaphore.cpp | Line 39 in Semaphore.cpp |
Semaphore::Semaphore() { sem_init(&m_sem, 0, 0); } Semaphore::Semaphore(unsigned int start_val) { sem_init(&m_sem, 0, start_val); | // --------------------------------------------------------------- #ifdef _WIN32 Semaphore::Semaphore(value_t start_val) { m_handle = ::CreateSemaphore((LPSECURITY_ATTRIBUTES)NULL, start_val, 1, (LPCTSTR)NULL); } Semaphore::~Semaphore() { ::CloseHandle(m_handle); } int Semaphore::Post() { return (::ReleaseSemaphore(m_handle, 1, (LPLONG)NULL) != 0) ? 0 : -1; } int Semaphore::Wait() { return (WaitForSingleObject(m_handle, INFINITE) == WAIT_OBJECT_0) ? 0 : -1; } int Semaphore::TryWait() { return -1; // %! not implemented } int Semaphore::GetValue(int& i) { return 0; // %! not implemented } // --------------------------------------------------------------- #else Semaphore::Semaphore(value_t start_val) { sem_init(&m_sem, 0, start_val); |
| Line 80 in Semaphore.cpp | Line 115 in Semaphore.cpp |
} #endif #ifdef SOCKETS_NAMESPACE | |
Semaphore.h | |
| /usr/src/Sockets-2.3.9.2/Semaphore.h 2010-02-09 21:16:24.0, 0100 | /usr/src/Sockets-2.3.9.3/Semaphore.h 2010-07-14 16:06:40.0, 0200 |
| Line 35 in Semaphore.h | Line 35 in Semaphore.h |
#include "sockets-config.h" #ifdef _WIN32 #include "socket_include.h" #include <windows.h> #else #include <pthread.h> #ifdef MACOSX | |
| Line 41 in Semaphore.h | Line 45 in Semaphore.h |
#include <semaphore.h> #endif #endif | |
| Line 47 in Semaphore.h | Line 52 in Semaphore.h |
#endif #ifdef _WIN32 typedef LONG value_t; #else typedef unsigned int value_t; #endif /** pthread semaphore wrapper. | |
| Line 53 in Semaphore.h | Line 63 in Semaphore.h |
{ public: Semaphore(); Semaphore(unsigned int start_val); ~Semaphore(); int Post(); int Wait(); int TryWait(); int GetValue(int&); | { public: Semaphore(value_t start_val = 0); ~Semaphore(); /** \return 0 if successful */ int Post(); /** Wait for Post \return 0 if successful */ int Wait(); /** Not implemented for win32 */ int TryWait(); /** Not implemented for win32 */ int GetValue(int&); |
| Line 65 in Semaphore.h | Line 81 in Semaphore.h |
Semaphore(const Semaphore& ) {} // copy constructor Semaphore& operator=(const Semaphore& ) { return *this; } // assignment operator #ifdef _WIN32 HANDLE m_handle; #else sem_t m_sem; #endif }; | |
Socket.cpp | |
| /usr/src/Sockets-2.3.9.2/Socket.cpp 2010-03-18 12:07:54.0, 0100 | /usr/src/Sockets-2.3.9.3/Socket.cpp 2010-07-14 14:43:21.0, 0200 |
| Line 54 in Socket.cpp | Line 54 in Socket.cpp |
#include "Ipv6Address.h" #endif #include "SocketThread.h" #ifdef _DEBUG | |
| Line 911 in Socket.cpp | Line 912 in Socket.cpp |
Socket::SocketThread::SocketThread(Socket *p) :Thread(false) ,m_socket(p) { // Creator will release } Socket::SocketThread::~SocketThread() { if (IsRunning()) { SetRelease(true); SetRunning(false); #ifdef _WIN32 Sleep(1000); #else sleep(1); #endif } } void Socket::SocketThread::Run() { SocketHandler h; h.SetSlave(); h.Add(m_socket); m_socket -> SetSlaveHandler(&h); m_socket -> OnDetached(); while (h.GetCount() && IsRunning()) { h.Select(0, 500000); } // m_socket now deleted oops // yeah oops m_socket delete its socket thread, that means this // so Socket will no longer delete its socket thread, instead we do this: SetDeleteOnExit(); } #endif // ENABLE_DETACH | |
Socket.h | |
| /usr/src/Sockets-2.3.9.2/Socket.h 2010-02-11 06:17:35.0, 0100 | /usr/src/Sockets-2.3.9.3/Socket.h 2010-07-14 12:32:04.0, 0200 |
| Line 55 in Socket.h | Line 55 in Socket.h |
class SocketAddress; class IFile; class SocketThread; | |
| Line 62 in Socket.h | Line 63 in Socket.h |
class Socket { // friend class ISocketHandler; #ifdef ENABLE_DETACH /** Detached socket run thread. \ingroup internal */ class SocketThread : public Thread { public: SocketThread(Socket *p); ~SocketThread(); void Run(); private: Socket *GetSocket() const { return m_socket; } SocketThread(const SocketThread& s) : m_socket(s.GetSocket()) {} SocketThread& operator=(const SocketThread& ) { return *this; } Socket *m_socket; }; #endif // ENABLE_DETACH /** Socket mode flags. */ /* | |
SocketHandler.cpp | |
| /usr/src/Sockets-2.3.9.2/SocketHandler.cpp 2010-03-18 12:13:43.0, 0100 | /usr/src/Sockets-2.3.9.3/SocketHandler.cpp 2010-07-14 16:08:12.0, 0200 |
| Line 47 in SocketHandler.cpp | Line 47 in SocketHandler.cpp |
#include "SocketAddress.h" #include "Exception.h" #include "SocketHandlerThread.h" #include "Lock.h" #ifdef SOCKETS_NAMESPACE | |
| Line 63 in SocketHandler.cpp | Line 65 in SocketHandler.cpp |
,m_mutex(m_mutex) ,m_b_use_mutex(false) ,m_parent(m_parent) ,m_b_parent_is_valid(false) ,m_release(NULL) ,m_maxsock(0) ,m_tlast(0) | |
| Line 96 in SocketHandler.cpp | Line 101 in SocketHandler.cpp |
,m_mutex(mutex) ,m_b_use_mutex(true) ,m_parent(m_parent) ,m_b_parent_is_valid(false) ,m_release(NULL) ,m_maxsock(0) ,m_tlast(0) ,m_b_check_callonconnect(false) ,m_b_check_detach(false) ,m_b_check_timeout(false) ,m_b_check_retry(false) ,m_b_check_close(false) #ifdef ENABLE_SOCKS4 ,m_socks4_host(0) ,m_socks4_port(0) ,m_bTryDirect(false) #endif #ifdef ENABLE_RESOLVER ,m_resolv_id(0) ,m_resolver(NULL) #endif #ifdef ENABLE_POOL ,m_b_enable_pool(false) #endif #ifdef ENABLE_DETACH ,m_slave(false) #endif { m_mutex.Lock(); FD_ZERO(&m_rfds); FD_ZERO(&m_wfds); FD_ZERO(&m_efds); } SocketHandler::SocketHandler(IMutex& mutex, ISocketHandler& parent, StdLog *p) :m_stdlog(p) ,m_mutex(mutex) ,m_b_use_mutex(true) ,m_parent(parent) ,m_b_parent_is_valid(true) ,m_release(NULL) ,m_maxsock(0) ,m_tlast(0) | |
| Line 128 in SocketHandler.cpp | Line 173 in SocketHandler.cpp |
SocketHandler::~SocketHandler() { for (std::list<SocketHandlerThread *>::iterator it = m_threads.begin(); it != m_threads.end(); it++) { SocketHandlerThread *p = *it; p -> Stop(); } #ifdef ENABLE_RESOLVER if (m_resolver) | |
| Line 184 in SocketHandler.cpp | Line 234 in SocketHandler.cpp |
ISocketHandler *SocketHandler::Create(StdLog *log) { return new SocketHandler(log); } ISocketHandler *SocketHandler::Create(IMutex& mutex, ISocketHandler& parent, StdLog *log) { return new SocketHandler(mutex, parent, log); } bool SocketHandler::ParentHandlerIsValid() { return m_b_parent_is_valid; } ISocketHandler& SocketHandler::ParentHandler() { if (!m_b_parent_is_valid) throw Exception("No parent sockethandler available"); return m_parent; } ISocketHandler& SocketHandler::GetRandomHandler() { if (m_threads.empty()) throw Exception("SocketHandler is not multithreaded"); size_t min_count = 99999; SocketHandlerThread *match = NULL; for (std::list<SocketHandlerThread *>::iterator it = m_threads.begin(); it != m_threads.end(); it++) { SocketHandlerThread *thr = *it; ISocketHandler& h = thr -> Handler(); { Lock lock(h.GetMutex()); size_t sz = h.GetCount(); if (sz < min_count) { min_count = sz; match = thr; } } } if (match) return match -> Handler(); throw Exception("Can't locate free threaded sockethandler"); } ISocketHandler& SocketHandler::GetEffectiveHandler() { return m_b_parent_is_valid ? m_parent : *this; } void SocketHandler::SetNumberOfThreads(size_t n) { if (!m_threads.empty()) { return; // already set } if (n > 1 && n < 256) { for (int i = 1; i <= (int)n; i++) { SocketHandlerThread *p = new SocketHandlerThread(*this); m_threads.push_back(p); p -> SetDeleteOnExit(); p -> Start(); p -> Wait(); } } } bool SocketHandler::IsThreaded() { return !m_threads.empty(); } void SocketHandler::EnableRelease() { if (m_release) return; m_release = new UdpSocket(*this); m_release -> SetDeleteByHandler(); port_t port = 0; m_release -> Bind("127.0.0.1", port); Add(m_release); } void SocketHandler::Release() { if (!m_release) return; m_release -> SendTo("127.0.0.1", m_release -> GetPort(), "\n"); } IMutex& SocketHandler::GetMutex() const { | |
| Line 717 in SocketHandler.cpp | Line 871 in SocketHandler.cpp |
} } if (!p -> CloseAndDelete()) { StreamSocket *scp = dynamic_cast<StreamSocket *>(p); | } } if (p -> CloseAndDelete()) { LogError(p, "Add", (int)p -> GetSocket(), "Added socket with SetCloseAndDelete() true", LOG_LEVEL_WARNING); m_sockets[s] = p; DeleteSocket(p); p -> Close(); } else { StreamSocket *scp = dynamic_cast<StreamSocket *>(p); |
| Line 738 in SocketHandler.cpp | Line 899 in SocketHandler.cpp |
} m_maxsock = (s > m_maxsock) ? s : m_maxsock; } else { LogError(p, "Add", (int)p -> GetSocket(), "Added socket with SetCloseAndDelete() true", LOG_LEVEL_WARNING); } m_sockets[s] = p; // m_add.erase(it); | } m_maxsock = (s > m_maxsock) ? s : m_maxsock; m_sockets[s] = p; } // m_add.erase(it); |
| Line 1061 in SocketHandler.cpp | Line 1218 in SocketHandler.cpp |
if (n == -1) // error on select { int err = Errno; /* EBADF An invalid file descriptor was given in one of the sets. | |
| Line 1067 in SocketHandler.cpp | Line 1225 in SocketHandler.cpp |
ENOMEM select was unable to allocate memory for internal tables. */ if (Errno == EBADF) { RebuildFdset(); } else if (Errno == EINTR) { } else if (Errno == EINVAL) { LogError(NULL, "SocketHandler::Select", Errno, StrError(Errno), LOG_LEVEL_FATAL); throw Exception("select(n): n is negative. Or struct timeval contains bad time values (<0)."); } else if (Errno == ENOMEM) { LogError(NULL, "SocketHandler::Select", Errno, StrError(Errno), LOG_LEVEL_ERROR); } } else | ENOMEM select was unable to allocate memory for internal tables. */ #ifdef _WIN32 switch (err) { case WSAENOTSOCK: RebuildFdset(); break; case WSAEINTR: case WSAEINPROGRESS: break; case WSAEINVAL: LogError(NULL, "SocketHandler::Select", err, StrError(err), LOG_LEVEL_FATAL); throw Exception("select(n): n is negative. Or struct timeval contains bad time values (<0)."); case WSAEFAULT: LogError(NULL, "SocketHandler::Select", err, StrError(err), LOG_LEVEL_ERROR); break; case WSANOTINITIALISED: throw Exception("WSAStartup not successfully called"); case WSAENETDOWN: throw Exception("Network subsystem failure"); } #else switch (err) { case EBADF: RebuildFdset(); break; case EINTR: break; case EINVAL: LogError(NULL, "SocketHandler::Select", err, StrError(err), LOG_LEVEL_FATAL); throw Exception("select(n): n is negative. Or struct timeval contains bad time values (<0)."); case ENOMEM: LogError(NULL, "SocketHandler::Select", err, StrError(err), LOG_LEVEL_ERROR); break; } #endif printf("error on select(): %d %s\n", Errno, StrError(err)); } else |
SocketHandlerEp.cpp | |
| /usr/src/Sockets-2.3.9.2/SocketHandlerEp.cpp 2010-02-15 14:44:37.0, 0100 | /usr/src/Sockets-2.3.9.3/SocketHandlerEp.cpp 2010-07-14 15:37:24.0, 0200 |
| Line 71 in SocketHandlerEp.cpp | Line 71 in SocketHandlerEp.cpp |
SocketHandlerEp::SocketHandlerEp(IMutex& mutex, ISocketHandler& parent, StdLog *p) :SocketHandler(mutex, parent, p) ,m_epoll(-1) { #ifdef LINUX m_epoll = epoll_create(FD_SETSIZE); if (m_epoll == -1) { throw Exception(StrError(Errno)); } #endif } SocketHandlerEp::~SocketHandlerEp() { | |
| Line 82 in SocketHandlerEp.cpp | Line 96 in SocketHandlerEp.cpp |
ISocketHandler *SocketHandlerEp::Create(StdLog *log) { return new SocketHandlerEp(log); } ISocketHandler *SocketHandlerEp::Create(IMutex& mutex, ISocketHandler& parent, StdLog *log) { return new SocketHandlerEp(mutex, parent, log); } #ifdef LINUX void SocketHandlerEp::ISocketHandler_Add(Socket *p,bool bRead,bool bWrite) | |
SocketHandlerEp.h | |
| /usr/src/Sockets-2.3.9.2/SocketHandlerEp.h 2010-03-18 12:02:52.0, 0100 | /usr/src/Sockets-2.3.9.3/SocketHandlerEp.h 2010-03-21 14:32:59.0, 0100 |
| Line 56 in SocketHandlerEp.h | Line 56 in SocketHandlerEp.h |
SocketHandlerEp(IMutex& mutex,StdLog *log = NULL); SocketHandlerEp(IMutex&, ISocketHandler& parent, StdLog * = NULL); ~SocketHandlerEp(); ISocketHandler *Create(StdLog * = NULL); ISocketHandler *Create(IMutex&, ISocketHandler&, StdLog * = NULL); #ifdef LINUX | |
SocketHandler.h | |
| /usr/src/Sockets-2.3.9.2/SocketHandler.h 2010-03-18 12:07:32.0, 0100 | /usr/src/Sockets-2.3.9.3/SocketHandler.h 2010-07-14 14:44:37.0, 0200 |
| Line 50 in SocketHandler.h | Line 50 in SocketHandler.h |
#endif class IMutex; class SocketHandlerThread; class UdpSocket; /** Socket container class, event generator. | |
| Line 69 in SocketHandler.h | Line 71 in SocketHandler.h |
SocketHandler(IMutex& mutex,StdLog *log = NULL); SocketHandler(IMutex&, ISocketHandler& parent, StdLog * = NULL); ~SocketHandler(); virtual ISocketHandler *Create(StdLog * = NULL); virtual ISocketHandler *Create(IMutex&, ISocketHandler&, StdLog * = NULL); virtual bool ParentHandlerIsValid(); virtual ISocketHandler& ParentHandler(); virtual ISocketHandler& GetRandomHandler(); virtual ISocketHandler& GetEffectiveHandler(); virtual void SetNumberOfThreads(size_t n); virtual bool IsThreaded(); virtual void EnableRelease(); virtual void Release(); /** Get mutex reference for threadsafe operations. */ IMutex& GetMutex() const; | |
| Line 121 in SocketHandler.h | Line 142 in SocketHandler.h |
void SetClose(bool = true); private: static FILE *m_event_file; static unsigned long m_event_counter; public: // Connection pool #ifdef ENABLE_POOL | |
| Line 216 in SocketHandler.h | Line 242 in SocketHandler.h |
IMutex& m_mutex; ///< Thread safety mutex bool m_b_use_mutex; ///< Mutex correctly initialized ISocketHandler& m_parent; bool m_b_parent_is_valid; private: | |
| Line 221 in SocketHandler.h | Line 249 in SocketHandler.h |
void Set(Socket *,bool,bool); // std::list<SocketHandlerThread *> m_threads; UdpSocket *m_release; // SOCKET m_maxsock; ///< Highest file descriptor + 1 in active sockets list fd_set m_rfds; ///< file descriptor set monitored for read events | |
socket_include.cpp | |
| /usr/src/Sockets-2.3.9.2/socket_include.cpp 2010-02-09 21:16:34.0, 0100 | /usr/src/Sockets-2.3.9.3/socket_include.cpp 2010-07-14 13:37:00.0, 0200 |
| Line 85 in socket_include.cpp | Line 85 in socket_include.cpp |
break; } #ifdef _WIN32 sprintf_s(tmp, sizeof(tmp), "Winsock error code: %d", x); #else snprintf(tmp, sizeof(tmp), "Winsock error code: %d", x); #endif return tmp; } | |
socket_include.h | |
| /usr/src/Sockets-2.3.9.2/socket_include.h 2010-02-09 21:16:36.0, 0100 | /usr/src/Sockets-2.3.9.3/socket_include.h 2010-07-14 13:40:19.0, 0200 |
| Line 184 in socket_include.h | Line 184 in socket_include.h |
#endif #define strcasecmp _stricmp #ifndef __CYGWIN__ #define snprintf sprintf_s #define vsnprintf vsprintf_s #endif typedef unsigned long ipaddr_t; | |
StdoutLog.cpp | |
| /usr/src/Sockets-2.3.9.2/StdoutLog.cpp 2010-02-09 21:16:54.0, 0100 | /usr/src/Sockets-2.3.9.3/StdoutLog.cpp 2010-07-14 14:07:53.0, 0200 |
| Line 47 in StdoutLog.cpp | Line 47 in StdoutLog.cpp |
if (lvl < m_min_level) return; time_t t = time(NULL); struct tm tp; #ifdef _WIN32 localtime_s(&tp, &t); #else localtime_r(&t, &tp); #endif std::string level; | if (lvl < m_min_level) return; char dt[40]; time_t t = time(NULL); #ifdef __CYGWIN__ struct tm *tp = localtime(&t); sprintf(dt, "%d-%02d-%02d %02d:%02d:%02d", tp -> tm_year + 1900, tp -> tm_mon + 1, tp -> tm_mday, tp -> tm_hour,tp -> tm_min,tp -> tm_sec); #else struct tm tp; #if defined( _WIN32) && !defined(__CYGWIN__) localtime_s(&tp, &t); #else localtime_r(&t, &tp); #endif sprintf(dt, "%d-%02d-%02d %02d:%02d:%02d", tp.tm_year + 1900, tp.tm_mon + 1, tp.tm_mday, tp.tm_hour,tp.tm_min,tp.tm_sec); #endif std::string level; |
| Line 73 in StdoutLog.cpp | Line 88 in StdoutLog.cpp |
if (sock) { printf("%d-%02d-%02d %02d:%02d:%02d :: fd %d :: %s: %d %s (%s)\n", tp.tm_year + 1900, tp.tm_mon + 1, tp.tm_mday, tp.tm_hour,tp.tm_min,tp.tm_sec, sock -> GetSocket(), call.c_str(),err,sys_err.c_str(),level.c_str()); | if (sock) { printf("%s :: fd %d :: %s: %d %s (%s)\n", dt, sock -> GetSocket(), call.c_str(),err,sys_err.c_str(),level.c_str()); |
| Line 83 in StdoutLog.cpp | Line 95 in StdoutLog.cpp |
else { printf("%d-%02d-%02d %02d:%02d:%02d :: %s: %d %s (%s)\n", tp.tm_year + 1900, tp.tm_mon + 1, tp.tm_mday, tp.tm_hour,tp.tm_min,tp.tm_sec, call.c_str(),err,sys_err.c_str(),level.c_str()); } | else { printf("%s :: %s: %d %s (%s)\n", dt, call.c_str(),err,sys_err.c_str(),level.c_str()); } |
TcpSocket.cpp | |
| /usr/src/Sockets-2.3.9.2/TcpSocket.cpp 2010-02-14 09:48:25.0, 0100 | /usr/src/Sockets-2.3.9.3/TcpSocket.cpp 2010-07-14 13:42:30.0, 0200 |
| Line 990 in TcpSocket.cpp | Line 990 in TcpSocket.cpp |
} } #ifdef _WIN32 strcpy_s(request + 8, sizeof(request) - 8, GetSocks4Userid().c_str()); #else | } } #if defined( _WIN32) && !defined(__CYGWIN__) strcpy_s(request + 8, sizeof(request) - 8, GetSocks4Userid().c_str()); #else |
| Line 1082 in TcpSocket.cpp | Line 1082 in TcpSocket.cpp |
va_start(ap, format); char slask[5000]; // vsprintf / vsnprintf temporary #ifdef _WIN32 vsprintf_s(slask, sizeof(slask), format, ap); #else vsnprintf(slask, sizeof(slask), format, ap); #endif va_end(ap); Send( slask ); | |
| Line 1377 in TcpSocket.cpp | Line 1373 in TcpSocket.cpp |
return 0; } #ifdef _WIN32 strcpy_s(buf, num, pw.c_str()); #else | return 0; } #if defined( _WIN32) && !defined(__CYGWIN__) strcpy_s(buf, num, pw.c_str()); #else |
Thread.cpp | |
| /usr/src/Sockets-2.3.9.2/Thread.cpp 2010-02-09 21:17:02.0, 0100 | /usr/src/Sockets-2.3.9.3/Thread.cpp 2010-07-14 15:39:08.0, 0200 |
| Line 39 in Thread.cpp | Line 39 in Thread.cpp |
#include "Thread.h" #include "Utility.h" | |
| Line 69 in Thread.cpp | Line 70 in Thread.cpp |
#endif m_release = release; if (release) m_sem.Post(); } | |
| Line 79 in Thread.cpp | Line 82 in Thread.cpp |
SetRelease(true); SetRunning(false); #ifdef _WIN32 Sleep(1000); #else sleep(1); #endif } #ifdef _WIN32 | SetRelease(true); SetRunning(false); /* Sleep one second to give thread class Run method enough time to release from run loop */ Utility::Sleep(1000); } #ifdef _WIN32 |
| Line 94 in Thread.cpp | Line 97 in Thread.cpp |
threadfunc_t STDPREFIX Thread::StartThread(threadparam_t zz) { Thread *p = (Thread *)zz; while (p -> m_running && !p -> m_release) { #ifdef _WIN32 Sleep(1000); #else sleep(1); #endif } if (p -> m_running) { | threadfunc_t STDPREFIX Thread::StartThread(threadparam_t zz) { /* Sleep here to wait for derived thread class constructor to setup vtable... hurts just looking at it */ Utility::Sleep(5); Thread *p = (Thread *)zz; p -> Wait(); if (p -> m_running) { |
| Line 141 in Thread.cpp | Line 143 in Thread.cpp |
{ m_release = x; if (x) m_sem.Post(); } | |
| Line 162 in Thread.cpp | Line 166 in Thread.cpp |
void Thread::Wait() { m_sem.Wait(); } #ifdef SOCKETS_NAMESPACE } | |
Thread.h | |
| /usr/src/Sockets-2.3.9.2/Thread.h 2010-02-09 21:17:03.0, 0100 | /usr/src/Sockets-2.3.9.3/Thread.h 2010-07-14 10:36:29.0, 0200 |
| Line 38 in Thread.h | Line 38 in Thread.h |
#include <pthread.h> #endif #include "Semaphore.h" #ifdef SOCKETS_NAMESPACE | |
| Line 90 in Thread.h | Line 91 in Thread.h |
bool IsDestructor(); void Start() { SetRelease(true); } void Stop() { Start(); SetRunning(false); } void Wait(); protected: #ifdef _WIN32 | |
| Line 101 in Thread.h | Line 113 in Thread.h |
Thread(const Thread& ) {} Thread& operator=(const Thread& ) { return *this; } Semaphore m_sem; bool m_running; bool m_release; | |
Utility.cpp | |
| /usr/src/Sockets-2.3.9.2/Utility.cpp 2010-02-09 21:17:08.0, 0100 | /usr/src/Sockets-2.3.9.3/Utility.cpp 2010-07-14 14:10:57.0, 0200 |
| Line 432 in Utility.cpp | Line 432 in Utility.cpp |
if (*slask && (x || !ok_to_skip || prev)) { #ifdef _WIN32 strcat_s(slask,sizeof(slask),":"); #else | if (*slask && (x || !ok_to_skip || prev)) { #if defined( _WIN32) && !defined(__CYGWIN__) strcat_s(slask,sizeof(slask),":"); #else |
| Line 568 in Utility.cpp | Line 568 in Utility.cpp |
const std::string Utility::GetEnv(const std::string& name) { #ifdef _WIN32 size_t sz = 0; char tmp[2048]; | const std::string Utility::GetEnv(const std::string& name) { #if defined( _WIN32) && !defined(__CYGWIN__) size_t sz = 0; char tmp[2048]; |
| Line 950 in Utility.cpp | Line 950 in Utility.cpp |
if (*slask && (x || !ok_to_skip || prev)) { #ifdef _WIN32 strcat_s(slask, sizeof(slask),":"); #else | if (*slask && (x || !ok_to_skip || prev)) { #if defined( _WIN32) && !defined(__CYGWIN__) strcat_s(slask, sizeof(slask),":"); #else |
| Line 971 in Utility.cpp | Line 971 in Utility.cpp |
if (!*slask) { #ifdef _WIN32 strcpy_s(slask, sizeof(slask), "::"); #else | if (!*slask) { #if defined( _WIN32) && !defined(__CYGWIN__) strcpy_s(slask, sizeof(slask), "::"); #else |
| Line 1394 in Utility.cpp | Line 1394 in Utility.cpp |
void Utility::Sleep(int ms) { #ifdef _WIN32 ::Sleep(ms); #else struct timeval tv; tv.tv_sec = ms / 1000; tv.tv_usec = (ms % 1000) * 1000; select(0, NULL, NULL, NULL, &tv); #endif } #ifdef SOCKETS_NAMESPACE } | |
Utility.h | |
| /usr/src/Sockets-2.3.9.2/Utility.h 2010-02-09 21:17:10.0, 0100 | /usr/src/Sockets-2.3.9.3/Utility.h 2010-07-14 12:22:44.0, 0200 |
| Line 220 in Utility.h | Line 220 in Utility.h |
static bool ChangeDirectory(const Path& to_dir); /** wait a specified number of ms */ static void Sleep(int ms); private: static std::string m_host; ///< local hostname | |