Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

tsync.c File Reference


Detailed Description

Time synchronization between two peers.

Author:
Raphael Manfredi
Date:
2004

#include "common.h"
#include "nodes.h"
#include "tsync.h"
#include "vmsg.h"
#include "clock.h"
#include "if/gnet_property_priv.h"
#include "lib/cq.h"
#include "lib/tm.h"
#include "lib/walloc.h"
#include "lib/override.h"

Data Structures

struct  tsync
 Records the time at which we sent a "Time Sync" to remote peers, along with the event that will expire those entries. More...


Defines

#define TSYNC_EXPIRE_MS   (60*1000) /**< Expiration time: 60 secs */
 Expiration time: 60 secs.


Enumerations

enum  tsync_magic_t { TSYNC_MAGIC = 0x781f372f }

Functions

 RCSID ("$Id:tsync.c, v 1.17 2005/09/10 08:17:29 daichik Exp $")
void tsync_free (struct tsync *ts)
 Free a tsync structure.

void tsync_expire (cqueue_t *unused_cq, gpointer obj)
 Expire the tsync record.

void tsync_send (struct gnutella_node *n, guint32 node_id)
 Send time synchronization request to specified node.

void tsync_send_timestamp (tm_t *orig, tm_t *final)
 Called when final "T1" timestamp was written to the request, which superseded the original timestamp we had.

void tsync_got_request (struct gnutella_node *n, tm_t *got)
 Got time request, answer it.

void tsync_got_reply (struct gnutella_node *n, tm_t *sent, tm_t *received, tm_t *replied, tm_t *got, gboolean ntp)
 Got a reply to our initial "Time Sync" request.

void tsync_init (void)
 Initializes the time synchronization.

void free_tsync_kv (gpointer unused_key, gpointer value, gpointer unused_udata)
 Get rid of the tsync structure held in the value.

void tsync_close (void)
 Cleanup at shutdown time.


Variables

GHashTable * tsync_by_time = NULL
 tm_t -> tsync


Define Documentation

#define TSYNC_EXPIRE_MS   (60*1000) /**< Expiration time: 60 secs */
 

Expiration time: 60 secs.


Enumeration Type Documentation

enum tsync_magic_t
 

Enumeration values:
TSYNC_MAGIC 


Function Documentation

void free_tsync_kv gpointer  unused_key,
gpointer  value,
gpointer  unused_udata
[static]
 

Get rid of the tsync structure held in the value.

RCSID "$Id:tsync.  c,
v 1.17 2005/09/10 08:17:29 daichik Exp $" 
 

void tsync_close void   ) 
 

Cleanup at shutdown time.

void tsync_expire cqueue_t unused_cq,
gpointer  obj
[static]
 

Expire the tsync record.

void tsync_free struct tsync ts  )  [static]
 

Free a tsync structure.

void tsync_got_reply struct gnutella_node n,
tm_t sent,
tm_t received,
tm_t replied,
tm_t got,
gboolean  ntp
 

Got a reply to our initial "Time Sync" request.

void tsync_got_request struct gnutella_node n,
tm_t got
 

Got time request, answer it.

Parameters:
n is the node from which we got the request
got is the timestamp at which we received the request

void tsync_init void   ) 
 

Initializes the time synchronization.

void tsync_send struct gnutella_node n,
guint32  node_id
 

Send time synchronization request to specified node.

When node_id is non-zero, it refers to the connected node to which we're sending the time synchronization request.

void tsync_send_timestamp tm_t orig,
tm_t final
 

Called when final "T1" timestamp was written to the request, which superseded the original timestamp we had.

Note that this routine will be called each time the message is scheduled for writing, which does not mean it will get written, especially when enqueued in a TCP message queue with lower stages flow-controlling...


Variable Documentation

GHashTable* tsync_by_time = NULL [static]
 

tm_t -> tsync


Generated on Sun Feb 12 10:50:08 2006 for Gtk-Gnutella by doxygen 1.3.6