diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/shutdown.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/src/shutdown.c b/src/shutdown.c index 3f0880b..f27c876 100644 --- a/src/shutdown.c +++ b/src/shutdown.c @@ -40,45 +40,37 @@ IceProtocolShutdown ( int majorOpcode ) { + int i; + if (iceConn->proto_ref_count == 0 || iceConn->process_msg_info == NULL || majorOpcode < 1 || majorOpcode > _IceLastMajorOpcode) { return (0); } - else - { - /* - * Make sure this majorOpcode is really being used. - */ - int i; - for (i = iceConn->his_min_opcode; i <= iceConn->his_max_opcode; i++) - { - if (iceConn->process_msg_info[ - i - iceConn->his_min_opcode].in_use && - iceConn->process_msg_info[ - i - iceConn->his_min_opcode].my_opcode == majorOpcode) - break; - } + /* + * Make sure this majorOpcode is really being used. + */ - if (i > iceConn->his_max_opcode) - { - return (0); - } - else + for (i = iceConn->his_min_opcode; i <= iceConn->his_max_opcode; i++) + { + int n = i - iceConn->his_min_opcode; + if (iceConn->process_msg_info[n].in_use && + iceConn->process_msg_info[n].my_opcode == majorOpcode) { + /* * OK, we can shut down the protocol. */ - iceConn->process_msg_info[ - i - iceConn->his_min_opcode].in_use = False; + iceConn->process_msg_info[n].in_use = False; iceConn->proto_ref_count--; - return (1); } } + + return (0); } |