comparison src/message/bye.c @ 0:d39e1d0d75b6

initial add
author paulo@hit-nxdomain.opendns.com
date Sat, 20 Feb 2010 21:18:28 -0800
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:38f592f88acb
1 /*
2 * $Id: bye.c,v 1.2 2004/01/07 07:27:18 hipnod Exp $
3 *
4 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net)
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 */
16
17 #include "gt_gnutella.h"
18 #include "message/msg_handler.h"
19
20 /* sent upon connection-close by some nodes */
21 GT_MSG_HANDLER(gt_msg_bye)
22 {
23 uint16_t code;
24 char *reason;
25
26 code = gt_packet_get_uint16 (packet);
27 reason = gt_packet_get_str (packet);
28
29 /* log the message and code and be done with it */
30 if (MSG_DEBUG)
31 {
32 GT->DBGFN (GT, "%s:%hu sent bye packet: code %hu, reason: %s",
33 net_ip_str (GT_NODE(c)->ip), GT_NODE(c)->gt_port,
34 code, reason);
35 }
36
37 /* we incur the TIME_WAIT penalty instead of the remote node if we
38 * close before they do */
39 gt_node_disconnect (c);
40 }