~ubuntu-branches/ubuntu/edgy/ncbi-tools6/edgy

« back to all changes in this revision

Viewing changes to connect/test/test_ncbi_service_connector.c

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2006-07-19 23:28:07 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060719232807-et3cdmcjgmnyleyx
Tags: 6.1.20060507-3ubuntu1
Re-merge with Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  $Id: test_ncbi_service_connector.c,v 6.34 2005/07/15 21:16:03 lavr Exp $
 
1
/*  $Id: test_ncbi_service_connector.c,v 6.37 2006/04/23 18:28:44 lavr Exp $
2
2
 * ===========================================================================
3
3
 *
4
4
 *                            PUBLIC DOMAIN NOTICE
47
47
    SConnNetInfo* net_info;
48
48
    CONNECTOR connector;
49
49
    EIO_Status status;
50
 
    STimeout* timeout;
51
50
    char ibuf[1024];
52
51
    CONN conn;
53
52
    size_t n;
55
54
    g_NCBI_ConnectRandomSeed = (int) time(0) ^ NCBI_CONNECT_SRAND_ADDEND;
56
55
    srand(g_NCBI_ConnectRandomSeed);
57
56
 
58
 
    CORE_SetLOGFormatFlags(fLOG_Full | fLOG_DateTime);
 
57
    CORE_SetLOGFormatFlags(fLOG_None          | fLOG_Level   |
 
58
                           fLOG_OmitNoteLevel | fLOG_DateTime);
59
59
    CORE_SetLOGFILE(stderr, 0/*false*/);
60
60
 
61
61
    net_info = ConnNetInfo_Create(service);
64
64
        strncpy0(obuf, argv[3], sizeof(obuf) - 2);
65
65
        obuf[n = strlen(obuf)] = '\n';
66
66
        obuf[++n]              = 0;
67
 
    } else {
68
67
    }
69
 
    strcpy(net_info->args, "testarg=testval&service=none");
70
 
    timeout = net_info->timeout;
 
68
    strcpy(net_info->args, "testarg=val&service=none&platform=none&address=2");
71
69
 
72
70
    connector = SERVICE_CreateConnectorEx(service, fSERV_Any, net_info, 0);
73
71
 
105
103
    }
106
104
 
107
105
    for (;;) {
108
 
       if (CONN_Wait(conn, eIO_Read, timeout) != eIO_Success) {
 
106
       if (CONN_Wait(conn, eIO_Read, net_info->timeout) != eIO_Success) {
109
107
            CONN_Close(conn);
110
108
            CORE_LOG(eLOG_Fatal, "Error waiting for reading");
111
109
        }
126
124
            break;
127
125
        }
128
126
    }
 
127
 
 
128
    ConnNetInfo_Destroy(net_info);
129
129
    CONN_Close(conn);
130
130
 
131
131
#if 0
153
153
        CORE_LOG(eLOG_Fatal, "Error reading from service ID1");
154
154
    }
155
155
 
156
 
    
157
 
    ConnNetInfo_Destroy(net_info);
158
156
    CORE_LOGF(eLOG_Note, ("%d bytes read from service ID1", n));
159
157
    CONN_Close(conn);
160
158
#endif
167
165
/*
168
166
 * --------------------------------------------------------------------------
169
167
 * $Log: test_ncbi_service_connector.c,v $
 
168
 * Revision 6.37  2006/04/23 18:28:44  lavr
 
169
 * Do not destroy SConnNetInfo prematurely; timeout is still in use
 
170
 *
 
171
 * Revision 6.36  2006/04/20 14:01:58  lavr
 
172
 * Cleanup to demonstrate no leaks; use short diag format
 
173
 *
 
174
 * Revision 6.35  2006/01/12 18:13:36  lavr
 
175
 * Add arguments to show that they must be replaced by standard ones
 
176
 *
170
177
 * Revision 6.34  2005/07/15 21:16:03  lavr
171
178
 * Fix int<->size_t mismatch bug causing 64-bit builds to check lamely
172
179
 *