diff options
Diffstat (limited to '')
-rw-r--r-- | o3000.c | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -869,23 +869,25 @@ int __stdcall o3000_send_xml(int id, const char *msg, int msg_len) { } /** - * Check whether all connections are closed. + * Get the number of open sessions. * - * @return 0 if all sessions are closed, error code otherwise defined at @ref o3000.h. + * @return number of open sessions */ -static int check_sessions(void) { - int i; +static int get_num_open_sessions(void) { + int i, num_sessions = 0; for(i = 0; i < MAX_NUM_SESSION; i++) { if(session_table[i] != NULL) { - break; + num_sessions ++; } } - if (i < MAX_NUM_SESSION) { - printf("%s: Session %d is still open.\n", __func__, i); - return O3000_ERROR_SESSION_STILL_OPEN; - } - return 0; + return num_sessions; + +// if (i < MAX_NUM_SESSION) { +// printf("%s: Session %d is still open.\n", __func__, i); +// return O3000_ERROR_SESSION_STILL_OPEN; +// } +// return 0; } /** @@ -897,7 +899,7 @@ static int check_sessions(void) { */ int __stdcall o3000_firmware_update(unsigned char *data, int data_len) { - int ret = 0; + int ret = 0, num_sessions; // paranoia checks if(data == NULL) { @@ -912,7 +914,9 @@ int __stdcall o3000_firmware_update(unsigned char *data, int data_len) { } // checking whether all connections are closed - if ((ret = check_sessions())) { + num_sessions = get_num_open_sessions(); + if (num_sessions > 0) { + ret = O3000_ERROR_SESSION_STILL_OPEN; printf("%s: Cannot proceed to firmware update: error code: %d.\n", __func__, ret); return ret; } |