From: blackh <gra...@li...> - 2002-01-24 21:07:33
|
blackh Thu Jan 24 13:07:31 2002 EDT Modified files: /grapevine/cpp IOLoop.cpp Log: Would not build on Potato. Index: grapevine/cpp/IOLoop.cpp diff -u grapevine/cpp/IOLoop.cpp:1.6 grapevine/cpp/IOLoop.cpp:1.7 --- grapevine/cpp/IOLoop.cpp:1.6 Thu Jan 17 08:00:09 2002 +++ grapevine/cpp/IOLoop.cpp Thu Jan 24 13:07:28 2002 @@ -1,4 +1,4 @@ -// $Id: IOLoop.cpp,v 1.6 2002/01/17 16:00:09 blackh Exp $ +// $Id: IOLoop.cpp,v 1.7 2002/01/24 21:07:28 blackh Exp $ #include "config.h" @@ -13,6 +13,12 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> // sleep() #endif +#ifdef HAVE_SYS_TIME_H + #include <sys/time.h> // struct timeval +#endif +#ifdef HAVE_SYS_TYPES_H + #include <sys/types.h> // struct timeval +#endif #ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> // inet_addr() #endif @@ -256,7 +262,9 @@ fd_set fired_writefds; memcpy(&fired_readfds, &readfds, sizeof(fired_readfds)); memcpy(&fired_writefds, &writefds, sizeof(fired_writefds)); - struct timeval onesecond = {1L, 0L}; + struct timeval onesecond; + onesecond.tv_sec = 1; + onesecond.tv_usec = 0; int ret = select(maxFD+1, &fired_readfds, &fired_writefds, NULL, &onesecond); if (ret < 0) { // If we get interrupted by a signal, then do nothing. |
From: blackh <gra...@li...> - 2002-04-03 19:39:45
|
blackh Wed Apr 3 11:39:43 2002 EDT Modified files: /grapevine/cpp IOLoop.cpp Log: Information about a strange assertion failure. Index: grapevine/cpp/IOLoop.cpp diff -u grapevine/cpp/IOLoop.cpp:1.18 grapevine/cpp/IOLoop.cpp:1.19 --- grapevine/cpp/IOLoop.cpp:1.18 Tue Mar 26 03:18:19 2002 +++ grapevine/cpp/IOLoop.cpp Wed Apr 3 11:39:42 2002 @@ -1,4 +1,4 @@ -// $Id: IOLoop.cpp,v 1.18 2002/03/26 11:18:19 rossta Exp $ +// $Id: IOLoop.cpp,v 1.19 2002/04/03 19:39:42 blackh Exp $ #include "config.h" @@ -445,6 +445,30 @@ if (firstTime || now > secondsNow) { secondsNow = now; timeNowFact.retrakt(); + + // After an hour or so of running, grapevine failed with the following + // assertion failure: + // + // grapevine: Fact.cpp:404: void Fact::set(String, Object, bool = false): Assertion `isF + // act() && !isNull()' failed. + // Aborted (core dumped) + // + // The stack trace was + // #0 0x403cc9f1 in kill () from /lib/libc.so.6 + // #1 0x40025c9e in pthread_kill () from /lib/libpthread.so.0 + // #2 0x4002616d in raise () from /lib/libpthread.so.0 + // #3 0x403cde51 in abort () from /lib/libc.so.6 + // #4 0x403c70b2 in __assert_fail () from /lib/libc.so.6 + // #5 0x080787f9 in Fact::set (this=0x81f6764, name= + // {<Object> = {impl = 0xbfffb998}, <No data fields>}, value= + // {impl = 0xbfffb99c}, isOptional=false) at Fact.cpp:404 + // #6 0x08087f51 in IOLoop::assertNow (this=0x81f6620) at IOLoop.cpp:448 + // #7 0x08087a1a in IOLoop::run (this=0x81f6620) at IOLoop.cpp:415 + // #8 0x0808334d in main (argc=1, argv=0xbffffc94) at grapevine.cpp:334 + // #9 0x403bc6cf in __libc_start_main () from /lib/libc.so.6 + // + // There's something funny going on here. I can't make any sense out of it right now. + // timeNowFact.set(String("secs"), String(now)); // timeNowFact->set(String("millis"), String(System::currentTimeMillis())); timeNowFact.remember(); |
From: blackh <gra...@li...> - 2003-03-01 12:46:31
|
blackh Sat Mar 1 04:46:30 2003 EDT Modified files: /grapevine/cpp IOLoop.cpp Log: Treat error statuses returned by accept() as being non-fatal. Index: grapevine/cpp/IOLoop.cpp diff -u grapevine/cpp/IOLoop.cpp:1.39 grapevine/cpp/IOLoop.cpp:1.40 --- grapevine/cpp/IOLoop.cpp:1.39 Sat Mar 1 03:23:42 2003 +++ grapevine/cpp/IOLoop.cpp Sat Mar 1 04:46:29 2003 @@ -1,4 +1,4 @@ -// $Id: IOLoop.cpp,v 1.39 2003/03/01 11:23:42 blackh Exp $ +// $Id: IOLoop.cpp,v 1.40 2003/03/01 12:46:29 blackh Exp $ #include "config.h" @@ -400,28 +400,29 @@ socklen_t addrlen = sizeof(addr); int newSocket = accept(i, (struct sockaddr*)&addr, &addrlen); if (newSocket < 0) - return String("accept() failed: ")+String(lastSocketErrorMessage()); - - int port = (*found1).second.first; - String domainName = (*found1).second.second; - - int ret = setNonBlocking(newSocket); - if (ret < 0) - return String("fcntl() failed: ")+String(lastSocketErrorMessage()); - - FD_SET(newSocket, &readfds); - if (newSocket >maxFD) - maxFD = newSocket; - openSockets[newSocket] = domainName; - Domain& domain = ruleBase->getDomain(domainName, true); - Fact fact(domain, "accept_"); - fact.set(String("fd"), String(newSocket)); - fact.set(String("port"), Integer(port)); - char* remoteAddr = inet_ntoa(addr.sin_addr); - fact.set(String("remoteAddr"), String(remoteAddr)); - int remotePort = ntohs(addr.sin_port); - fact.set(String("remotePort"), Integer(remotePort)); - reportError(fact.remember()); + Print::println(String("accept() failed: ")+String(lastSocketErrorMessage())); + else { + int port = (*found1).second.first; + String domainName = (*found1).second.second; + + int ret = setNonBlocking(newSocket); + if (ret < 0) + return String("fcntl() failed: ")+String(lastSocketErrorMessage()); + + FD_SET(newSocket, &readfds); + if (newSocket >maxFD) + maxFD = newSocket; + openSockets[newSocket] = domainName; + Domain& domain = ruleBase->getDomain(domainName, true); + Fact fact(domain, "accept_"); + fact.set(String("fd"), String(newSocket)); + fact.set(String("port"), Integer(port)); + char* remoteAddr = inet_ntoa(addr.sin_addr); + fact.set(String("remoteAddr"), String(remoteAddr)); + int remotePort = ntohs(addr.sin_port); + fact.set(String("remotePort"), Integer(remotePort)); + reportError(fact.remember()); + } } else { map<int, String>::iterator found = openSockets.find(i); |
From: blackh <gra...@li...> - 2003-03-12 10:09:06
|
blackh Wed Mar 12 02:09:06 2003 EDT Modified files: /grapevine/cpp IOLoop.cpp Log: Try this on Windows 98. Index: grapevine/cpp/IOLoop.cpp diff -u grapevine/cpp/IOLoop.cpp:1.42 grapevine/cpp/IOLoop.cpp:1.43 --- grapevine/cpp/IOLoop.cpp:1.42 Tue Mar 11 16:31:26 2003 +++ grapevine/cpp/IOLoop.cpp Wed Mar 12 02:09:05 2003 @@ -1,4 +1,4 @@ -// $Id: IOLoop.cpp,v 1.42 2003/03/12 00:31:26 blackh Exp $ +// $Id: IOLoop.cpp,v 1.43 2003/03/12 10:09:05 blackh Exp $ #include "config.h" @@ -225,6 +225,8 @@ We can then look at 'getsockname' and hey presto, we can find out what local interface would be used to send packets to that remote address without actually sending any. + + Except it's not that simple on Windows 98. */ String IOLoop::localInterfaceFor(String remoteHost) { @@ -250,40 +252,32 @@ if (ret < 0) return String(); + closeSocket(sock); + #ifdef __WIN32__ if (addr.sin_addr.S_un.S_addr == 0UL) { /* Windows 98 will return 0.0.0.0 per MSDN: - The getsockname function does not always return information about the host address + The getsockname function does not always return information about the host address when the socket has been bound to an unspecified address, unless the socket has been connected with connect or accept (for example, using ADDR_ANY). - A Windows Sockets application must not assume that the address will be specified unless - the socket is connected. The address that will be used for the socket is unknown unless - the socket is connected when used in a multihomed host. If the socket is using a - connectionless protocol, the address may not be available until I/O occurs on the socket. - - So, let's send 1 byte, to see if it wakes up. + We tried sending a single byte out the socket, but that didn't work, and it is + also not what we want to do. - Is this reasonable to do? - - ** This doesn't work, but I'll fix it shortly. - SB + So, on Windows 98 we will assume the box is not multi-homed, and look up its IP + address from its name. The question is, will this work on a simple Windows 98 box + that's dialled up to the net???? */ - cout << "found 0.0.0.0 " << std::flush; - - ret = ::send(sock, "1", 1, 0); - if (ret <= 0) - return String(); - - len = sizeof(addr); - ret = ::getsockname(sock, (sockaddr*) &addr, &len); + ret = gethostname(name, sizeof(name)-1); if (ret < 0) return String(); + + if (!resolve(name, addr.sin_addr)) + return String(); } #endif - - closeSocket(sock); return String(inet_ntoa(addr.sin_addr)); } |
From: rossta <gra...@li...> - 2003-04-22 20:08:11
|
rossta Tue Apr 22 13:08:09 2003 EDT Modified files: /grapevine/cpp IOLoop.cpp Log: Cygwin build fix Index: grapevine/cpp/IOLoop.cpp diff -u grapevine/cpp/IOLoop.cpp:1.45 grapevine/cpp/IOLoop.cpp:1.46 --- grapevine/cpp/IOLoop.cpp:1.45 Fri Apr 18 02:36:00 2003 +++ grapevine/cpp/IOLoop.cpp Tue Apr 22 13:08:06 2003 @@ -1,4 +1,4 @@ -// $Id: IOLoop.cpp,v 1.45 2003/04/18 09:36:00 blackh Exp $ +// $Id: IOLoop.cpp,v 1.46 2003/04/22 20:08:06 rossta Exp $ #include "config.h" @@ -24,7 +24,9 @@ #endif #ifndef HAVE_IN_ADDR_T - typedef unsigned long int in_addr_t; + #ifndef __CYGWIN__ + typedef unsigned long int in_addr_t; + #endif #endif #include "Assertion.h" @@ -257,8 +259,8 @@ /* Note: Windows 98 will return 0.0.0.0 per MSDN: - The getsockname function does not always return information about the host address - when the socket has been bound to an unspecified address, unless the socket has been + The getsockname function does not always return information about the host address + when the socket has been bound to an unspecified address, unless the socket has been connected with connect or accept (for example, using ADDR_ANY). We will tolerate this in the raisen code. |
From: blackh <gra...@li...> - 2003-07-24 00:03:21
|
blackh Wed Jul 23 17:03:17 2003 EDT Modified files: /grapevine/cpp IOLoop.cpp Log: Bug fix (wouldn't release firmware). Index: grapevine/cpp/IOLoop.cpp diff -u grapevine/cpp/IOLoop.cpp:1.51 grapevine/cpp/IOLoop.cpp:1.52 --- grapevine/cpp/IOLoop.cpp:1.51 Thu Jul 10 04:02:14 2003 +++ grapevine/cpp/IOLoop.cpp Wed Jul 23 17:03:17 2003 @@ -1,4 +1,4 @@ -// $Id: IOLoop.cpp,v 1.51 2003/07/10 11:02:14 blackh Exp $ +// $Id: IOLoop.cpp,v 1.52 2003/07/24 00:03:17 blackh Exp $ #include "config.h" @@ -338,6 +338,7 @@ bool IOLoop::anySockets() { return + ioEventQueue.begin() != ioEventQueue.end() || listenSockets.begin() != listenSockets.end() || openSockets.begin() != openSockets.end() || connectingSockets.begin() != connectingSockets.end() || |
From: Ross S. <ro...@sm...> - 2002-01-24 21:15:43
|
> [mailto:gra...@li...]On Behalf Of > blackh > Would not build on Potato. Whatcha doin' buildin' on potato? |