- time_stamp(&time);
-
- error = ZOOM_connection_error(z[i-1] , &errmsg, &addinfo);
- if (error)
- parameters.progress[i] = -progress;
- else
- parameters.progress[i] += 1;
-
- printf ("%d\t%ld.%06ld\t%d\t%d\t%s\t%d\t%s\n",
- i-1, time_sec(&time), time_usec(&time),
- parameters.progress[i],
- event, zoom_events[event],
- error, errmsg);
+ /* progress zeroing */
+ for (i = 0; i < 4096; i++){
+ parameters.progress[i] = k * 5 -1;
+ }
+
+ /* connect to all concurrent connections*/
+ for ( i = 0; i < parameters.concurrent; i++){
+ /* set event count to zero */
+ elc[k * parameters.concurrent + i] = 0;
+
+ /* create connection - pass options (they are the same for all) */
+ z[i] = ZOOM_connection_create(o);
+
+ /* connect and init */
+ ZOOM_connection_connect(z[i], parameters.host, 0);
+ }
+ /* search all */
+ for (i = 0; i < parameters.concurrent; i++)
+ r[i] = ZOOM_connection_search_pqf (z[i], parameters.query);
+
+ /* network I/O. pass number of connections and array of connections */
+ while ((i = ZOOM_event (parameters.concurrent, z))){
+ int event = ZOOM_connection_last_event(z[i-1]);
+ const char *errmsg;
+ const char *addinfo;
+ int error = 0;
+ //int progress = zoom_progress[event];
+
+ if (event == ZOOM_EVENT_SEND_DATA || event == ZOOM_EVENT_RECV_DATA)
+ continue;
+
+ time_stamp(&time);
+
+ /* updating events and event list */
+ error = ZOOM_connection_error(z[i-1] , &errmsg, &addinfo);
+ if (error)
+ parameters.progress[i] = zoom_progress[ZOOM_EVENT_UNKNOWN];
+ //parameters.progress[i] = zoom_progress[ZOOM_EVENT_NONE];
+ else if (event == ZOOM_EVENT_CONNECT)
+ parameters.progress[i] = zoom_progress[event];
+ else
+ //parameters.progress[i] = zoom_progress[event];
+ parameters.progress[i] += 1;
+
+ update_events(elc, els,
+ k, i-1,
+ time_sec(&time), time_usec(&time),
+ parameters.progress[i],
+ event, zoom_events[event],
+ error, errmsg);
+ }