summaryrefslogtreecommitdiff
path: root/zebra/zebra_ptm.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_ptm.c')
-rw-r--r--zebra/zebra_ptm.c66
1 files changed, 38 insertions, 28 deletions
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index bc924842d4..68d2bff718 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -13,10 +13,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
@@ -182,12 +181,14 @@ zebra_ptm_flush_messages (struct thread *thread)
close(ptm_cb.ptm_sock);
ptm_cb.ptm_sock = -1;
zebra_ptm_reset_status(0);
- ptm_cb.t_timer = thread_add_timer (zebrad.master, zebra_ptm_connect,
- NULL, ptm_cb.reconnect_time);
+ ptm_cb.t_timer = NULL;
+ thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+ &ptm_cb.t_timer);
return (-1);
case BUFFER_PENDING:
- ptm_cb.t_write = thread_add_write(zebrad.master, zebra_ptm_flush_messages,
- NULL, ptm_cb.ptm_sock);
+ ptm_cb.t_write = NULL;
+ thread_add_write(zebrad.master, zebra_ptm_flush_messages, NULL, ptm_cb.ptm_sock,
+ &ptm_cb.t_write);
break;
case BUFFER_EMPTY:
break;
@@ -207,15 +208,16 @@ zebra_ptm_send_message(char *data, int size)
close(ptm_cb.ptm_sock);
ptm_cb.ptm_sock = -1;
zebra_ptm_reset_status(0);
- ptm_cb.t_timer = thread_add_timer (zebrad.master, zebra_ptm_connect,
- NULL, ptm_cb.reconnect_time);
+ ptm_cb.t_timer = NULL;
+ thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+ &ptm_cb.t_timer);
return -1;
case BUFFER_EMPTY:
THREAD_OFF(ptm_cb.t_write);
break;
case BUFFER_PENDING:
- THREAD_WRITE_ON(zebrad.master, ptm_cb.t_write,
- zebra_ptm_flush_messages, NULL, ptm_cb.ptm_sock);
+ thread_add_write(zebrad.master, zebra_ptm_flush_messages, NULL,
+ ptm_cb.ptm_sock, &ptm_cb.t_write);
break;
}
@@ -234,8 +236,9 @@ zebra_ptm_connect (struct thread *t)
if (ptm_cb.ptm_sock != -1) {
if (init) {
- ptm_cb.t_read = thread_add_read (zebrad.master, zebra_ptm_sock_read,
- NULL, ptm_cb.ptm_sock);
+ ptm_cb.t_read = NULL;
+ thread_add_read(zebrad.master, zebra_ptm_sock_read, NULL, ptm_cb.ptm_sock,
+ &ptm_cb.t_read);
zebra_bfd_peer_replay_req();
}
zebra_ptm_send_status_req();
@@ -245,8 +248,9 @@ zebra_ptm_connect (struct thread *t)
if (ptm_cb.reconnect_time > ZEBRA_PTM_RECONNECT_TIME_MAX)
ptm_cb.reconnect_time = ZEBRA_PTM_RECONNECT_TIME_MAX;
- ptm_cb.t_timer = thread_add_timer (zebrad.master, zebra_ptm_connect, NULL,
- ptm_cb.reconnect_time);
+ ptm_cb.t_timer = NULL;
+ thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+ &ptm_cb.t_timer);
} else if (ptm_cb.reconnect_time >= ZEBRA_PTM_RECONNECT_TIME_MAX){
ptm_cb.reconnect_time = ZEBRA_PTM_RECONNECT_TIME_INITIAL;
}
@@ -653,14 +657,16 @@ zebra_ptm_sock_read (struct thread *thread)
close (ptm_cb.ptm_sock);
ptm_cb.ptm_sock = -1;
zebra_ptm_reset_status(0);
- ptm_cb.t_timer = thread_add_timer (zebrad.master, zebra_ptm_connect,
- NULL, ptm_cb.reconnect_time);
+ ptm_cb.t_timer = NULL;
+ thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+ &ptm_cb.t_timer);
return (-1);
}
}
- ptm_cb.t_read = thread_add_read (zebrad.master, zebra_ptm_sock_read,
- NULL, ptm_cb.ptm_sock);
+ ptm_cb.t_read = NULL;
+ thread_add_read(zebrad.master, zebra_ptm_sock_read, NULL, ptm_cb.ptm_sock,
+ &ptm_cb.t_read);
return 0;
}
@@ -697,8 +703,9 @@ zebra_ptm_bfd_dst_register (struct zserv *client, int sock, u_short length,
if (ptm_cb.ptm_sock == -1)
{
- ptm_cb.t_timer = thread_add_timer (zebrad.master, zebra_ptm_connect,
- NULL, ptm_cb.reconnect_time);
+ ptm_cb.t_timer = NULL;
+ thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+ &ptm_cb.t_timer);
return -1;
}
@@ -854,8 +861,9 @@ zebra_ptm_bfd_dst_deregister (struct zserv *client, int sock, u_short length,
if (ptm_cb.ptm_sock == -1)
{
- ptm_cb.t_timer = thread_add_timer (zebrad.master, zebra_ptm_connect,
- NULL, ptm_cb.reconnect_time);
+ ptm_cb.t_timer = NULL;
+ thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+ &ptm_cb.t_timer);
return -1;
}
@@ -976,8 +984,9 @@ zebra_ptm_bfd_client_register (struct zserv *client, int sock, u_short length)
if (ptm_cb.ptm_sock == -1)
{
- ptm_cb.t_timer = thread_add_timer (zebrad.master, zebra_ptm_connect,
- NULL, ptm_cb.reconnect_time);
+ ptm_cb.t_timer = NULL;
+ thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+ &ptm_cb.t_timer);
return -1;
}
@@ -1026,8 +1035,9 @@ zebra_ptm_bfd_client_deregister (int proto)
if (ptm_cb.ptm_sock == -1)
{
- ptm_cb.t_timer = thread_add_timer (zebrad.master, zebra_ptm_connect,
- NULL, ptm_cb.reconnect_time);
+ ptm_cb.t_timer = NULL;
+ thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+ &ptm_cb.t_timer);
return;
}