paulo@0: /* paulo@0: * $Id: bye.c,v 1.2 2004/01/07 07:27:18 hipnod Exp $ paulo@0: * paulo@0: * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) paulo@0: * paulo@0: * This program is free software; you can redistribute it and/or modify it paulo@0: * under the terms of the GNU General Public License as published by the paulo@0: * Free Software Foundation; either version 2, or (at your option) any paulo@0: * later version. paulo@0: * paulo@0: * This program is distributed in the hope that it will be useful, but paulo@0: * WITHOUT ANY WARRANTY; without even the implied warranty of paulo@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU paulo@0: * General Public License for more details. paulo@0: */ paulo@0: paulo@0: #include "gt_gnutella.h" paulo@0: #include "message/msg_handler.h" paulo@0: paulo@0: /* sent upon connection-close by some nodes */ paulo@0: GT_MSG_HANDLER(gt_msg_bye) paulo@0: { paulo@0: uint16_t code; paulo@0: char *reason; paulo@0: paulo@0: code = gt_packet_get_uint16 (packet); paulo@0: reason = gt_packet_get_str (packet); paulo@0: paulo@0: /* log the message and code and be done with it */ paulo@0: if (MSG_DEBUG) paulo@0: { paulo@0: GT->DBGFN (GT, "%s:%hu sent bye packet: code %hu, reason: %s", paulo@0: net_ip_str (GT_NODE(c)->ip), GT_NODE(c)->gt_port, paulo@0: code, reason); paulo@0: } paulo@0: paulo@0: /* we incur the TIME_WAIT penalty instead of the remote node if we paulo@0: * close before they do */ paulo@0: gt_node_disconnect (c); paulo@0: }