*/
GNUNET_PEER_Id other_peer;
- /**
- * Our Peer Identity (for debugging)
- */
- GNUNET_PEER_Id our_id;
-
/**
* The application port number (type: uint32_t)
*/
*/
void *listen_cb_cls;
- /**
- * Our interned Peer's identity
- */
- GNUNET_PEER_Id our_id;
-
/**
* The service port
* FIXME: Remove if not required!
&& (ntohs (message->header.type) <= GNUNET_MESSAGE_TYPE_STREAM_CLOSE_ACK));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Queueing message of type %d and size %d\n",
- socket->our_id,
+ "Queueing message of type %d and size %d\n",
ntohs (message->header.type),
ntohs (message->header.size));
GNUNET_assert (NULL != message);
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Retransmitting DATA...\n", socket->our_id);
+ "Retransmitting DATA...\n");
socket->retransmission_timeout_task_id = GNUNET_SCHEDULER_NO_TASK;
write_data (socket);
}
packet))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Placing DATA message with sequence %u in send queue\n",
- socket->our_id,
+ "Placing DATA message with sequence %u in send queue\n",
ntohl (io_handle->messages[packet]->sequence_number));
copy_and_queue_message (socket,
socket->receiver_window_available -=
ntohs (io_handle->messages[packet]->header.header.size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Placing DATA message with sequence %u in send queue\n",
- socket->our_id,
+ "Placing DATA message with sequence %u in send queue\n",
ntohl (io_handle->messages[packet]->sequence_number));
copy_and_queue_message (socket,
&io_handle->messages[packet]->header,
/* Call the data processor */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Calling read processor\n",
- socket->our_id);
+ "Calling read processor\n");
read_size =
socket->read_handle->proc (socket->read_handle->proc_cls,
socket->status,
socket->receive_buffer + socket->copy_offset,
valid_read_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Read processor read %d bytes\n",
- socket->our_id,
+ "Read processor read %d bytes\n",
read_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Read processor completed successfully\n",
- socket->our_id);
+ "Read processor completed successfully\n");
/* Free the read handle */
GNUNET_free (socket->read_handle);
sequence_increase = packet;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Sequence increase after read processor completion: %u\n",
- socket->our_id,
+ "Sequence increase after read processor completion: %u\n",
sequence_increase);
/* Shift the data in the receive buffer */
if (socket->read_task_id != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Read task timedout - Cancelling it\n",
- socket->our_id);
+ "Read task timedout - Cancelling it\n");
GNUNET_SCHEDULER_cancel (socket->read_task_id);
socket->read_task_id = GNUNET_SCHEDULER_NO_TASK;
}
if (GNUNET_PEER_search (sender) != socket->other_peer)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received DATA from non-confirming peer\n",
- socket->our_id);
+ "Received DATA from non-confirming peer\n");
return GNUNET_YES;
}
if ( relative_sequence_number > GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Ignoring received message with sequence number %u\n",
- socket->our_id,
+ "Ignoring received message with sequence number %u\n",
ntohl (msg->sequence_number));
/* Start ACK sending task if one is not already present */
if (GNUNET_SCHEDULER_NO_TASK == socket->ack_task_id)
relative_sequence_number))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Ignoring already received message with sequence "
+ "Ignoring already received message with sequence "
"number %u\n",
- socket->our_id,
ntohl (msg->sequence_number));
/* Start ACK sending task if one is not already present */
if (GNUNET_SCHEDULER_NO_TASK == socket->ack_task_id)
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Receiving DATA with sequence number: %u and size: %d "
- "from %x\n",
- socket->our_id,
+ "Receiving DATA with sequence number: %u and size: %d from %x\n",
ntohl (msg->sequence_number),
ntohs (msg->header.header.size),
socket->other_peer);
else
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Cannot accommodate packet %d as buffer is",
- "full\n",
- socket->our_id,
+ "Cannot accommodate packet %d as buffer is full\n",
ntohl (msg->sequence_number));
return GNUNET_YES;
}
0)))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Scheduling read processor\n",
- socket->our_id);
+ "Scheduling read processor\n");
socket->read_task_id =
GNUNET_SCHEDULER_add_now (&call_read_processor,
default:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received data message when it cannot be handled\n",
- socket->our_id);
+ "Received data message when it cannot be handled\n");
break;
}
return GNUNET_YES;
struct GNUNET_PeerIdentity initiator_pid;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Attaining ESTABLISHED state\n",
- socket->our_id);
+ "Attaining ESTABLISHED state\n");
socket->write_offset = 0;
socket->read_offset = 0;
socket->state = STATE_ESTABLISHED;
{
GNUNET_PEER_resolve (socket->other_peer, &initiator_pid);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Calling listen callback\n",
- socket->our_id);
+ "Calling listen callback\n");
if (GNUNET_SYSERR ==
socket->lsocket->listen_cb (socket->lsocket->listen_cb_cls,
socket,
{
GNUNET_assert (STATE_INIT == socket->state);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Attaining HELLO_WAIT state\n",
- socket->our_id);
+ "Attaining HELLO_WAIT state\n");
socket->state = STATE_HELLO_WAIT;
}
struct GNUNET_STREAM_Socket *socket)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Attaing CLOSE_WAIT state\n",
- socket->our_id);
+ "Attaing CLOSE_WAIT state\n");
socket->state = STATE_CLOSE_WAIT;
GNUNET_free_non_null (socket->receive_buffer); /* Free the receive buffer */
socket->receive_buffer = NULL;
struct GNUNET_STREAM_Socket *socket)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Attaing RECEIVE_CLOSE_WAIT state\n",
- socket->our_id);
+ "Attaing RECEIVE_CLOSE_WAIT state\n");
socket->state = STATE_RECEIVE_CLOSE_WAIT;
GNUNET_free_non_null (socket->receive_buffer); /* Free the receive buffer */
socket->receive_buffer = NULL;
struct GNUNET_STREAM_Socket *socket)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Attaing TRANSMIT_CLOSE_WAIT state\n",
- socket->our_id);
+ "Attaining TRANSMIT_CLOSE_WAIT state\n");
socket->state = STATE_TRANSMIT_CLOSE_WAIT;
}
socket->write_sequence_number =
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Generated write sequence number %u\n",
- socket->our_id,
+ "Generated write sequence number %u\n",
(unsigned int) socket->write_sequence_number);
msg = GNUNET_malloc (sizeof (struct GNUNET_STREAM_HelloAckMessage));
if (GNUNET_PEER_search (sender) != socket->other_peer)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received HELLO_ACK from non-confirming peer\n",
- socket->our_id);
+ "Received HELLO_ACK from non-confirming peer\n");
return GNUNET_YES;
}
ack_msg = (const struct GNUNET_STREAM_HelloAckMessage *) message;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received HELLO_ACK from %x\n",
- socket->our_id,
+ "Received HELLO_ACK from %x\n",
socket->other_peer);
GNUNET_assert (socket->tunnel == tunnel);
case STATE_HELLO_WAIT:
socket->read_sequence_number = ntohl (ack_msg->sequence_number);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Read sequence number %u\n",
- socket->our_id,
+ "Read sequence number %u\n",
(unsigned int) socket->read_sequence_number);
socket->receiver_window_available = ntohl (ack_msg->receiver_window_size);
reply = generate_hello_ack_msg (socket);
case STATE_INIT:
default:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Server %x sent HELLO_ACK when in state %d\n",
- socket->our_id,
+ "Server %x sent HELLO_ACK when in state %d\n",
socket->other_peer,
socket->state);
socket->state = STATE_CLOSED; // introduce STATE_ERROR?
if (NULL == shutdown_handle)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received *CLOSE_ACK when shutdown handle is NULL\n",
- socket->our_id);
+ "Received *CLOSE_ACK when shutdown handle is NULL\n");
return GNUNET_OK;
}
if (SHUT_RDWR != shutdown_handle->operation)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received CLOSE_ACK when shutdown handle "
- "is not for SHUT_RDWR\n",
- socket->our_id);
+ "Received CLOSE_ACK when shutdown handle is not for SHUT_RDWR\n");
return GNUNET_OK;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received CLOSE_ACK from %x\n",
- socket->our_id,
+ "Received CLOSE_ACK from %x\n",
socket->other_peer);
socket->state = STATE_CLOSED;
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received CLOSE_ACK when in it not expected\n",
- socket->our_id);
+ "Received CLOSE_ACK when in it not expected\n");
return GNUNET_OK;
}
break;
if (SHUT_RD != shutdown_handle->operation)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received RECEIVE_CLOSE_ACK when shutdown handle "
- "is not for SHUT_RD\n",
- socket->our_id);
+ "Received RECEIVE_CLOSE_ACK when shutdown handle is not for SHUT_RD\n");
return GNUNET_OK;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received RECEIVE_CLOSE_ACK from %x\n",
- socket->our_id,
+ "Received RECEIVE_CLOSE_ACK from %x\n",
socket->other_peer);
socket->state = STATE_RECEIVE_CLOSED;
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received RECEIVE_CLOSE_ACK when in it not expected\n",
- socket->our_id);
+ "Received RECEIVE_CLOSE_ACK when in it not expected\n");
return GNUNET_OK;
}
if (SHUT_WR != shutdown_handle->operation)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received TRANSMIT_CLOSE_ACK when shutdown handle "
- "is not for SHUT_WR\n",
- socket->our_id);
+ "Received TRANSMIT_CLOSE_ACK when shutdown handle is not for SHUT_WR\n");
return GNUNET_OK;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received TRANSMIT_CLOSE_ACK from %x\n",
- socket->our_id,
+ "Received TRANSMIT_CLOSE_ACK from %x\n",
socket->other_peer);
socket->state = STATE_TRANSMIT_CLOSED;
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received TRANSMIT_CLOSE_ACK when in it not expected\n",
- socket->our_id);
+ "Received TRANSMIT_CLOSE_ACK when in it not expected\n");
return GNUNET_OK;
}
case STATE_LISTEN:
case STATE_HELLO_WAIT:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Ignoring RECEIVE_CLOSE as it cannot be handled now\n",
- socket->our_id);
+ "Ignoring RECEIVE_CLOSE as it cannot be handled now\n");
return GNUNET_OK;
default:
break;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received RECEIVE_CLOSE from %x\n",
- socket->our_id,
+ "Received RECEIVE_CLOSE from %x\n",
socket->other_peer);
receive_close_ack =
GNUNET_malloc (sizeof (struct GNUNET_STREAM_MessageHeader));
case STATE_LISTEN:
case STATE_HELLO_WAIT:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Ignoring RECEIVE_CLOSE as it cannot be handled now\n",
- socket->our_id);
+ "Ignoring RECEIVE_CLOSE as it cannot be handled now\n");
return GNUNET_OK;
default:
break;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received CLOSE from %x\n",
- socket->our_id,
+ "Received CLOSE from %x\n",
socket->other_peer);
close_ack = GNUNET_malloc (sizeof (struct GNUNET_STREAM_MessageHeader));
close_ack->header.size = htons (sizeof (struct GNUNET_STREAM_MessageHeader));
if (GNUNET_PEER_search (sender) != socket->other_peer)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received HELLO from non-confirming peer\n",
- socket->our_id);
+ "Received HELLO from non-confirming peer\n");
return GNUNET_YES;
}
ntohs (message->type));
GNUNET_assert (socket->tunnel == tunnel);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received HELLO from %x\n",
- socket->our_id,
+ "Received HELLO from %x\n",
socket->other_peer);
if (STATE_INIT == socket->state)
if (STATE_HELLO_WAIT == socket->state)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received HELLO_ACK from %x\n",
- socket->our_id,
+ "Received HELLO_ACK from %x\n",
socket->other_peer);
socket->read_sequence_number = ntohl (ack_message->sequence_number);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Read sequence number %u\n",
- socket->our_id,
+ "Read sequence number %u\n",
(unsigned int) socket->read_sequence_number);
socket->receiver_window_available =
ntohl (ack_message->receiver_window_size);
if (GNUNET_PEER_search (sender) != socket->other_peer)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received ACK from non-confirming peer\n",
- socket->our_id);
+ "Received ACK from non-confirming peer\n");
return GNUNET_YES;
}
if (NULL == socket->write_handle)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received DATA_ACK when write_handle is NULL\n",
- socket->our_id);
+ "Received DATA_ACK when write_handle is NULL\n");
return GNUNET_OK;
}
/* FIXME: increment in the base sequence number is breaking current flow
- ntohl (ack->base_sequence_number)) < GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received DATA_ACK with unexpected base sequence "
- "number\n",
- socket->our_id);
+ "Received DATA_ACK with unexpected base sequence number\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Current write sequence: %u; Ack's base sequence: %u\n",
- socket->our_id,
+ "Current write sequence: %u; Ack's base sequence: %u\n",
socket->write_sequence_number,
ntohl (ack->base_sequence_number));
return GNUNET_OK;
acks */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Received DATA_ACK from %x\n",
- socket->our_id,
+ "Received DATA_ACK from %x\n",
socket->other_peer);
/* Cancel the retransmission task */
socket->status,
socket->write_handle->size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Write completion callback completed\n",
- socket->our_id);
+ "Write completion callback completed\n");
/* We are done with the write handle - Freeing it */
GNUNET_free (socket->write_handle);
socket->write_handle = NULL;
if (connected_peer != socket->other_peer)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: A peer which is not our target has connected",
- "to our tunnel\n",
- socket->our_id);
+ "A peer which is not our target has connected to our tunnel\n");
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Target peer %x connected\n",
- socket->our_id,
+ "Target peer %x connected\n",
connected_peer);
/* Set state to INIT */
/* If the state is SHUTDOWN its ok; else set the state of the socket to SYSERR */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Other peer %x disconnected \n",
- socket->our_id,
+ "Other peer %x disconnected\n",
socket->other_peer);
}
socket->tunnel = tunnel;
socket->session_id = 0; /* FIXME */
socket->state = STATE_INIT;
- socket->lsocket = lsocket;
- socket->our_id = lsocket->our_id;
-
+ socket->lsocket = lsocket;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Peer %x initiated tunnel to us\n",
- socket->our_id,
+ "Peer %x initiated tunnel to us\n",
socket->other_peer);
/* FIXME: Copy MESH handle from lsocket to socket */
GNUNET_break_op(0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: Peer %x has terminated connection abruptly\n",
- socket->our_id,
+ "Peer %x has terminated connection abruptly\n",
socket->other_peer);
socket->status = GNUNET_STREAM_SHUTDOWN;
...)
{
struct GNUNET_STREAM_Socket *socket;
- struct GNUNET_PeerIdentity own_peer_id;
enum GNUNET_STREAM_Option option;
GNUNET_MESH_ApplicationType ports[] = {app_port, 0};
va_list vargs; /* Variable arguments */
socket->other_peer = GNUNET_PEER_intern (target);
socket->open_cb = open_cb;
socket->open_cls = open_cb_cls;
- GNUNET_TESTING_get_peer_identity (cfg, &own_peer_id);
- socket->our_id = GNUNET_PEER_intern (&own_peer_id);
-
/* Set defaults */
socket->retransmit_timeout =
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, default_timeout);
/* FIXME: Add variable args for passing configration options? */
struct GNUNET_STREAM_ListenSocket *lsocket;
GNUNET_MESH_ApplicationType ports[] = {app_port, 0};
- struct GNUNET_PeerIdentity our_peer_id;
lsocket = GNUNET_malloc (sizeof (struct GNUNET_STREAM_ListenSocket));
lsocket->port = app_port;
lsocket->listen_cb = listen_cb;
lsocket->listen_cb_cls = listen_cb_cls;
- GNUNET_TESTING_get_peer_identity (cfg, &our_peer_id);
- lsocket->our_id = GNUNET_PEER_intern (&our_peer_id);
lsocket->mesh = GNUNET_MESH_connect (cfg,
10, /* FIXME: QUEUE size as parameter? */
lsocket, /* Closure */
struct GNUNET_STREAM_IOReadHandle *read_handle;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: %s()\n",
- socket->our_id,
+ "%s()\n",
__func__);
/* Return NULL if there is already a read handle; the user has to cancel that
case STATE_CLOSE_WAIT:
proc (proc_cls, GNUNET_STREAM_SHUTDOWN, NULL, 0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: %s() END\n",
- socket->our_id,
+ "%s() END\n",
__func__);
return NULL;
default:
&read_io_timeout,
socket);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%x: %s() END\n",
- socket->our_id,
+ "%s() END\n",
__func__);
return read_handle;
}