X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=zlint%2Fzlint.cpp;h=a0ad235a65680f7bf93433284a8d7dfdffe720e9;hb=da5e82516b0b66ec65e6af4779f2fdbf29d42e5e;hp=c8325e0d176a3e1413fad1cb05cff926805ae56e;hpb=7411ed6df7fc0b535f83503f73d70e80f390e295;p=yazpp-moved-to-github.git diff --git a/zlint/zlint.cpp b/zlint/zlint.cpp index c8325e0..a0ad235 100644 --- a/zlint/zlint.cpp +++ b/zlint/zlint.cpp @@ -1,10 +1,11 @@ -/* - * Copyright (c) 2004, Index Data. +/* This file is part of the yazpp toolkit. + * Copyright (C) 1998-2012 Index Data and Mike Taylor * See the file LICENSE for details. - * - * $Id: zlint.cpp,v 1.11 2005-06-25 15:53:21 adam Exp $ */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -16,6 +17,11 @@ #include +Zlint_test::~Zlint_test() +{ + +} + class Zlint_t { public: friend class Zlint; @@ -29,9 +35,9 @@ private: int m_test_reported; }; -Zlint::Zlint(IPDU_Observable *the_PDU_Observable) : +Zlint::Zlint(IPDU_Observable *the_PDU_Observable) : Z_Assoc(the_PDU_Observable) - + { m_PDU_Observable = the_PDU_Observable; m_host = 0; @@ -73,13 +79,12 @@ void Zlint::timeoutNotify() { if (m_cur_test->m_t->recv_fail(this, 2) != TEST_FINISHED) { - close(); client(m_host); timeout(30); return; } + close_goto_next(); } - close_goto_next(); } void Zlint::failNotify() @@ -88,13 +93,12 @@ void Zlint::failNotify() { if (m_cur_test->m_t->recv_fail(this, 1) != TEST_FINISHED) { - close(); client(m_host); timeout(30); return; } + close_goto_next(); } - close_goto_next(); } void Zlint::connectNotify() @@ -103,8 +107,8 @@ void Zlint::connectNotify() { if (m_cur_test->m_t->init(this) != TEST_FINISHED) return; + close_goto_next(); } - close_goto_next(); } void Zlint::recv_GDU(Z_GDU *gdu, int len) @@ -116,23 +120,25 @@ void Zlint::recv_GDU(Z_GDU *gdu, int len) return; if (r == TEST_REOPEN) { - close(); client(m_host); timeout(30); return; } + close_goto_next(); } - close_goto_next(); } void Zlint::close_goto_next() { - close(); if (m_cur_test) m_cur_test = m_cur_test->m_next; if (m_cur_test) + { client(m_host); - timeout(30); + timeout(30); + } + else + close(); } IPDU_Observer *Zlint::sessionNotify( @@ -143,7 +149,7 @@ IPDU_Observer *Zlint::sessionNotify( Z_ReferenceId *Zlint::mk_refid(const char *buf, int len) { - Z_ReferenceId *id = + Z_ReferenceId *id = (Z_ReferenceId *) odr_malloc(odr_encode(), sizeof(*id)); id->size = id->len = len; id->buf = (unsigned char*) odr_malloc(odr_encode(), len); @@ -154,15 +160,12 @@ Z_ReferenceId *Zlint::mk_refid(const char *buf, int len) int Zlint::initResponseGetVersion(Z_InitResponse *init) { int no = 0; - int off = 0; int i; for (i = 0; i<12; i++) if (ODR_MASK_GET(init->protocolVersion, no)) { no = i+1; } - else - off = 1; return no; } @@ -266,6 +269,7 @@ Zlint_code Zlint_test_simple::recv_fail(Zlint *z, int reason) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab