#include "disk.h"
#include "gnunet_container_lib.h"
+#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
+#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename)
+#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall)
+
#define DEBUG_NETWORK GNUNET_EXTRA_LOGGING
#define DEBUG_W32_CYCLES GNUNET_EXTRA_LOGGING
{
SetErrnoFromWinsockError (WSAGetLastError ());
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "ioctlsocket");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "ioctlsocket");
return GNUNET_SYSERR;
}
return GNUNET_OK;
if (flags == -1)
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "fcntl");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "fcntl");
return GNUNET_SYSERR;
}
if (doBlock)
if (0 != fcntl (fd->fd, F_SETFL, flags))
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "fcntl");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "fcntl");
return GNUNET_SYSERR;
}
return GNUNET_OK;
if (0 !=
setsockopt (h->fd, SOL_SOCKET, SO_NOSIGPIPE, &abs_value,
sizeof (abs_value)))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
}
#endif
int value = 1;
if (0 != setsockopt (h->fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof (value)))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
#else
const char *abs_value = "1";
if (0 !=
setsockopt (h->fd, IPPROTO_TCP, TCP_NODELAY, abs_value,
sizeof (abs_value)))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
#endif
}
#if DEBUG_NETWORK
{
struct sockaddr name;
- int namelen = sizeof (name);
+ socklen_t namelen = sizeof (name);
int gsn = getsockname (desc->fd, &name, &namelen);
if (gsn == 0)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Accepting connection on `%s'\n",
- GNUNET_a2s (&name, namelen));
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Accepting connection on `%s'\n",
+ GNUNET_a2s (&name, namelen));
}
#endif
ret->fd = accept (desc->fd, address, address_len);
#ifndef MINGW
if (GNUNET_OK != socket_set_inheritable (ret))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- "socket_set_inheritable");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+ "socket_set_inheritable");
#endif
#ifdef DARWIN
socket_set_nosigpipe (ret);
if (desc->af == AF_INET6)
if (0 != setsockopt (desc->fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof (on)))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "setsockopt");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt");
#endif
#endif
#ifndef WINDOWS
/* This is required, and required here, but only on UNIX */
if (0 != setsockopt (desc->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "setsockopt");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "setsockopt");
#endif
#ifndef LINUX
#ifndef MINGW
DWORD error = 0;
#if DEBUG_NETWORK
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_NETWORK_socket_close",
- "Closing 0x%x\n", desc->fd);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Closing 0x%x\n",
+ desc->fd);
#endif
SetLastError (0);
ret = closesocket (desc->fd);
error = WSAGetLastError ();
SetErrnoFromWinsockError (error);
#if DEBUG_NETWORK
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_NETWORK_socket_close",
- "Closed 0x%x, closesocket() returned %d, GLE is %u\n",
- desc->fd, ret, error);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Closed 0x%x, closesocket() returned %d, GLE is %u\n", desc->fd, ret,
+ error);
#endif
#else
ret = close (desc->fd);
const struct sockaddr_un *un = (const struct sockaddr_un *) desc->addr;
if (0 != unlink (un->sun_path))
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink",
- un->sun_path);
+ LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "unlink", un->sun_path);
}
#endif
#endif
* @return NULL on error (including not supported on target platform)
*/
struct GNUNET_NETWORK_Handle *
-GNUNET_NETWORK_socket_box_native (int fd)
+GNUNET_NETWORK_socket_box_native (SOCKTYPE fd)
{
+ struct GNUNET_NETWORK_Handle *ret;
#if MINGW
- return NULL;
+ unsigned long i;
+ DWORD d;
+ /* FIXME: Find a better call to check that FD is valid */
+ if (WSAIoctl (fd, FIONBIO, (void *) &i, sizeof (i), NULL, 0, &d, NULL, NULL) != 0)
+ return NULL; /* invalid FD */
+ ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_Handle));
+ ret->fd = fd;
+ ret->af = AF_UNSPEC;
+ return ret;
#else
- struct GNUNET_NETWORK_Handle *ret;
-
if (fcntl (fd, F_GETFD) < 0)
return NULL; /* invalid FD */
ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_Handle));
#ifndef MINGW
if (GNUNET_OK != socket_set_inheritable (ret))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- "socket_set_inheritable");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+ "socket_set_inheritable");
#endif
#ifdef DARWIN
socket_set_nosigpipe (ret);
GNUNET_NETWORK_socket_disable_corking (struct GNUNET_NETWORK_Handle *desc)
{
int ret = 0;
+
#if WINDOWS
int value = 0;
(ret =
setsockopt (desc->fd, SOL_SOCKET, SO_SNDBUF, (char *) &value,
sizeof (value))))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
if (0 !=
(ret =
setsockopt (desc->fd, SOL_SOCKET, SO_RCVBUF, (char *) &value,
sizeof (value))))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
#elif LINUX
int value = 0;
if (0 !=
(ret =
setsockopt (desc->fd, SOL_SOCKET, SO_SNDBUF, &value, sizeof (value))))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
if (0 !=
(ret =
setsockopt (desc->fd, SOL_SOCKET, SO_RCVBUF, &value, sizeof (value))))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "setsockopt");
#endif
return ret == 0 ? GNUNET_OK : GNUNET_SYSERR;
}
return GNUNET_YES;
}
#else
- struct GNUNET_CONTAINER_SList_Iterator *it;
+ struct GNUNET_CONTAINER_SList_Iterator it;
struct GNUNET_DISK_FileHandle *h;
int i;
int j;
}
}
it = GNUNET_CONTAINER_slist_begin (fds1->handles);
- while (GNUNET_CONTAINER_slist_end (it) != GNUNET_YES)
+ while (GNUNET_CONTAINER_slist_end (&it) != GNUNET_YES)
{
#if DEBUG_NETWORK
- struct GNUNET_CONTAINER_SList_Iterator *t;
+ struct GNUNET_CONTAINER_SList_Iterator t;
#endif
- h = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (it, NULL);
+ h = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (&it,
+ NULL);
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Checking that FD 0x%x is in another set:\n", h->h);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Checking that FD 0x%x is in another set:\n",
+ h->h);
for (t = GNUNET_CONTAINER_slist_begin (fds2->handles);
- GNUNET_CONTAINER_slist_end (t) != GNUNET_YES;
- GNUNET_CONTAINER_slist_next (t))
+ GNUNET_CONTAINER_slist_end (&t) != GNUNET_YES;
+ GNUNET_CONTAINER_slist_next (&t))
{
struct GNUNET_DISK_FileHandle *fh;
- fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (t,
+ fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (&t,
NULL);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "0x%x\n", fh->h);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "0x%x\n", fh->h);
}
#endif
if (GNUNET_CONTAINER_slist_contains
(fds2->handles, h, sizeof (struct GNUNET_DISK_FileHandle)))
{
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Match!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Match!\n");
#endif
- GNUNET_CONTAINER_slist_iter_destroy (it);
return GNUNET_YES;
}
- GNUNET_CONTAINER_slist_next (it);
+ GNUNET_CONTAINER_slist_next (&it);
}
- GNUNET_CONTAINER_slist_iter_destroy (it);
#endif
return GNUNET_NO;
}
handles += read_handles = GNUNET_CONTAINER_slist_count (rfds->handles);
#if DEBUG_NETWORK
{
- struct GNUNET_CONTAINER_SList_Iterator *t;
+ struct GNUNET_CONTAINER_SList_Iterator t;
for (t = GNUNET_CONTAINER_slist_begin (rfds->handles);
- GNUNET_CONTAINER_slist_end (t) != GNUNET_YES;
- GNUNET_CONTAINER_slist_next (t))
+ GNUNET_CONTAINER_slist_end (&t) != GNUNET_YES;
+ GNUNET_CONTAINER_slist_next (&t))
{
struct GNUNET_DISK_FileHandle *fh;
- fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (t,
+ fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (&t,
NULL);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FD 0x%x (0x%x) is SET in rfds\n",
- fh->h, fh);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "FD 0x%x (0x%x) is SET in rfds\n", fh->h,
+ fh);
}
}
#endif
#endif
)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _
- ("Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n"),
- "select");
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ _
+ ("Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n"),
+ "select");
GNUNET_break (0);
}
#ifndef MINGW
/* Read Pipes */
if (rfds && read_handles)
{
- struct GNUNET_CONTAINER_SList_Iterator *i;
+ struct GNUNET_CONTAINER_SList_Iterator i;
for (i = GNUNET_CONTAINER_slist_begin (rfds->handles);
- GNUNET_CONTAINER_slist_end (i) != GNUNET_YES;
- GNUNET_CONTAINER_slist_next (i))
+ GNUNET_CONTAINER_slist_end (&i) != GNUNET_YES;
+ GNUNET_CONTAINER_slist_next (&i))
{
struct GNUNET_DISK_FileHandle *fh;
- fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (i,
+ fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (&i,
NULL);
if (fh->type == GNUNET_PIPE)
{
/* Read zero bytes to check the status of the pipe */
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Reading 0 bytes from the pipe 0x%x\n", fh->h);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Reading 0 bytes from the pipe 0x%x\n",
+ fh->h);
#endif
if (!ReadFile (fh->h, NULL, 0, NULL, fh->oOverlapRead))
{
if (error_code == ERROR_IO_PENDING)
{
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding the pipe's 0x%x overlapped event to the array as %d\n",
- fh->h, nhandles);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding the pipe's 0x%x overlapped event to the array as %d\n",
+ fh->h, nhandles);
#endif
handle_array[nhandles++] = fh->oOverlapRead->hEvent;
readArray[readPipes++] = fh;
else
{
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding the read ready event to the array as %d\n",
- nhandles);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding the read ready event to the array as %d\n", nhandles);
#endif
handle_array[nhandles++] = hEventReadReady;
readArray[readPipes++] = fh;
fh, sizeof (struct GNUNET_DISK_FileHandle));
}
}
- GNUNET_CONTAINER_slist_iter_destroy (i);
}
if (wfds && write_handles)
{
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding the write ready event to the array as %d\n", nhandles);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding the write ready event to the array as %d\n", nhandles);
#endif
handle_array[nhandles++] = hEventPipeWrite;
writePipePos = nhandles;
}
if (efds && ex_handles)
{
- struct GNUNET_CONTAINER_SList_Iterator *i;
+ struct GNUNET_CONTAINER_SList_Iterator i;
for (i = GNUNET_CONTAINER_slist_begin (efds->handles);
- GNUNET_CONTAINER_slist_end (i) != GNUNET_YES;
- GNUNET_CONTAINER_slist_next (i))
+ GNUNET_CONTAINER_slist_end (&i) != GNUNET_YES;
+ GNUNET_CONTAINER_slist_next (&i))
{
struct GNUNET_DISK_FileHandle *fh;
DWORD dwBytes;
- fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (i,
+ fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (&i,
NULL);
if (fh->type == GNUNET_PIPE)
{
}
}
}
- GNUNET_CONTAINER_slist_iter_destroy (i);
}
if (nfds > 0)
{
if (rfds)
{
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding the socket read event to the array as %d\n",
- nhandles);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding the socket read event to the array as %d\n", nhandles);
#endif
handle_array[nhandles++] = hEventRead;
nSockEvents++;
int wakeup = 0;
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding the socket write event to the array as %d\n",
- nhandles);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding the socket write event to the array as %d\n", nhandles);
#endif
handle_array[nhandles++] = hEventWrite;
nSockEvents++;
status = send (wfds->sds.fd_array[i], NULL, 0, 0);
error = GetLastError ();
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "pre-send to the socket %d returned %d (%u)\n", i, status,
- error);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "pre-send to the socket %d returned %d (%u)\n", i, status, error);
#endif
if (status == 0 || (error != WSAEWOULDBLOCK && error != WSAENOTCONN))
wakeup = 1;
if (efds)
{
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding the socket error event to the array as %d\n",
- nhandles);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding the socket error event to the array as %d\n", nhandles);
#endif
handle_array[nhandles++] = hEventException;
nSockEvents++;
handle_array[nhandles] = NULL;
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Number nfds : %d\n", nfds);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Number of handles : %d\n", nhandles);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "retcode : %d\n", newretcode);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Will wait : %d\n", ms_total);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Number nfds : %d\n", nfds);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Number of handles : %d\n", nhandles);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "retcode : %d\n", newretcode);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Will wait : %d\n", ms_total);
#endif
if (nhandles)
returncode =
WaitForMultipleObjects (nhandles, handle_array, FALSE, ms_total);
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "WaitForMultipleObjects Returned : %d\n",
- returncode);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "WaitForMultipleObjects Returned : %d\n",
+ returncode);
#endif
returnedpos = returncode - WAIT_OBJECT_0;
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "return pos is : %d\n", returnedpos);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "return pos is : %d\n", returnedpos);
#endif
/* FIXME: THIS LINE IS WRONG !! We should add to handles only handles that fired the events, not all ! */
if (retcode == -1)
retcode = 0;
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Select retcode : %d\n", retcode);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Select retcode : %d\n", retcode);
#endif
}
/* FIXME: <= writePipePos? Really? */
GNUNET_CONTAINER_slist_append (handles_write, wfds->handles);
retcode += write_handles;
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Added write pipe\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Added write pipe\n");
#endif
}
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ReadPipes is : %d\n", readPipes);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "ReadPipes is : %d\n", readPipes);
#endif
/* We have some pipes ready for read. */
/* FIXME: it is supposed to work !! Only choose the Pipes who fired the event, but it is not working */
* for (i = 0; i < readPipes; i++)
* {
* waitstatus = WaitForSingleObject (handle_array[i], 0);
- * GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Read pipe %d wait status is : %d\n", i, waitstatus);
+ * LOG (GNUNET_ERROR_TYPE_DEBUG, "Read pipe %d wait status is : %d\n", i, waitstatus);
* if (waitstatus != WAIT_OBJECT_0)
* continue;
* GNUNET_CONTAINER_slist_add (handles_read,
* GNUNET_CONTAINER_SLIST_DISPOSITION_TRANSIENT,
* readArray[i], sizeof (struct GNUNET_DISK_FileHandle));
* retcode++;
- * GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Added read Pipe\n");
+ * LOG (GNUNET_ERROR_TYPE_DEBUG, "Added read Pipe\n");
* }
*/
for (i = 0; i < readPipes; i++)
PeekNamedPipe (readArray[i]->h, NULL, 0, NULL, &waitstatus, NULL);
error = GetLastError ();
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Peek at read pipe %d (0x%x) returned %d (%d bytes available) GLE %u\n",
- i, readArray[i]->h, bret, waitstatus, error);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Peek at read pipe %d (0x%x) returned %d (%d bytes available) GLE %u\n",
+ i, readArray[i]->h, bret, waitstatus, error);
#endif
if (bret == 0)
{
sizeof (struct GNUNET_DISK_FileHandle));
retcode++;
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Added read Pipe 0x%x (0x%x)\n",
- readArray[i], readArray[i]->h);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Added read Pipe 0x%x (0x%x)\n",
+ readArray[i], readArray[i]->h);
#endif
}
}
waitstatus = WaitForSingleObject (hEventWrite, 0);
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Wait for the write event returned %d\n", waitstatus);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Wait for the write event returned %d\n",
+ waitstatus);
#endif
if (waitstatus == WAIT_OBJECT_0)
{
status = send (wfds->sds.fd_array[i], NULL, 0, 0);
error = GetLastError ();
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "send to the socket %d returned %d (%u)\n", i, status,
- error);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "send to the socket %d returned %d (%u)\n", i, status, error);
#endif
if (status == 0 || (error != WSAEWOULDBLOCK && error != WSAENOTCONN) ||
(status == -1 && gso_result == 0 && error == WSAENOTCONN &&
}
#if DEBUG_NETWORK
if (!nhandles || (returnedpos >= nhandles))
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Returning from _select() with nothing!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Returning from _select() with nothing!\n");
#endif
if (rfds)
{
- struct GNUNET_CONTAINER_SList_Iterator *t;
+ struct GNUNET_CONTAINER_SList_Iterator t;
for (i = 0; i < rfds->sds.fd_count; i++)
{
nsock++;
}
for (t = GNUNET_CONTAINER_slist_begin (rfds->handles);
- GNUNET_CONTAINER_slist_end (t) != GNUNET_YES;
- GNUNET_CONTAINER_slist_next (t))
+ GNUNET_CONTAINER_slist_end (&t) != GNUNET_YES;
+ GNUNET_CONTAINER_slist_next (&t))
{
struct GNUNET_DISK_FileHandle *fh;
- fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (t,
+ fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (&t,
NULL);
if (fh->type == GNUNET_PIPE)
{
CancelIo (fh->h);
}
}
- GNUNET_CONTAINER_slist_iter_destroy (t);
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zeroing rfds\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Zeroing rfds\n");
#endif
GNUNET_NETWORK_fdset_zero (rfds);
if (retcode != -1 && nhandles && (returnedpos < nhandles))
nsock++;
}
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zeroing wfds\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Zeroing wfds\n");
#endif
GNUNET_NETWORK_fdset_zero (wfds);
if (retcode != -1 && nhandles && (returnedpos < nhandles))
nsock++;
}
#if DEBUG_NETWORK
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zeroing efds\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Zeroing efds\n");
#endif
GNUNET_NETWORK_fdset_zero (efds);
if (retcode != -1 && nhandles && (returnedpos < nhandles))
#if DEBUG_NETWORK
if (rfds)
{
- struct GNUNET_CONTAINER_SList_Iterator *t;
+ struct GNUNET_CONTAINER_SList_Iterator t;
for (i = 0; i < bread.fd_count; i++)
{
if (bread.fd_array[i] != 0)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FD 0x%x is %s in rfds\n",
- bread.fd_array[i],
- (SAFE_FD_ISSET (bread.fd_array[i], rfds)) ? "SET" :
- "NOT SET");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "FD 0x%x is %s in rfds\n",
+ bread.fd_array[i],
+ (SAFE_FD_ISSET (bread.fd_array[i], rfds)) ? "SET" : "NOT SET");
}
for (t = GNUNET_CONTAINER_slist_begin (rfds->handles);
- GNUNET_CONTAINER_slist_end (t) != GNUNET_YES;
- GNUNET_CONTAINER_slist_next (t))
+ GNUNET_CONTAINER_slist_end (&t) != GNUNET_YES;
+ GNUNET_CONTAINER_slist_next (&t))
{
struct GNUNET_DISK_FileHandle *fh;
- fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (t,
+ fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (&t,
NULL);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FD 0x%x is SET in rfds\n", fh->h);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "FD 0x%x is SET in rfds\n", fh->h);
}
}
if (wfds)
for (i = 0; i < bwrite.fd_count; i++)
{
if (bwrite.fd_array[i] != 0)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FD 0x%x is %s in wfds\n",
- bwrite.fd_array[i],
- (SAFE_FD_ISSET (bwrite.fd_array[i], rfds)) ? "SET" :
- "NOT SET");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "FD 0x%x is %s in wfds\n",
+ bwrite.fd_array[i],
+ (SAFE_FD_ISSET (bwrite.fd_array[i], rfds)) ? "SET" : "NOT SET");
}
}
if (efds)
for (i = 0; i < bexcept.fd_count; i++)
{
if (bexcept.fd_array[i] != 0)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FD 0x%x is %s in efds\n",
- bexcept.fd_array[i],
- (SAFE_FD_ISSET (bexcept.fd_array[i], rfds)) ? "SET" :
- "NOT SET");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "FD 0x%x is %s in efds\n",
+ bexcept.fd_array[i],
+ (SAFE_FD_ISSET (bexcept.fd_array[i], rfds)) ? "SET" : "NOT SET");
}
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Returning %d or 0\n", retcode);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Returning %d or 0\n", retcode);
#endif
if (nhandles && (returnedpos < nhandles))
return retcode;