Apple Bug probably resolved with retry to reconnect with SCARD_LEAVE_CARD; refs #34
This commit is contained in:
		
							
								
								
									
										19
									
								
								src/pcsc.hxx
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/pcsc.hxx
									
									
									
									
									
								
							@@ -327,18 +327,21 @@ namespace pcsc {
 | 
			
		||||
                            "Retry Nr. "<<cnt);
 | 
			
		||||
                  try {
 | 
			
		||||
                    reconnect();
 | 
			
		||||
                    check(SCardTransmit(_id, &rPci,
 | 
			
		||||
                                        (LPCBYTE)in.c_str(),
 | 
			
		||||
                                        in.size(),
 | 
			
		||||
                                        0, buff, &len),
 | 
			
		||||
                          "smartcard transmit resend message "+crypto::hex(in));
 | 
			
		||||
                    if (check(SCardTransmit(_id, &rPci,
 | 
			
		||||
                                            (LPCBYTE)in.c_str(),
 | 
			
		||||
                                            in.size(),
 | 
			
		||||
                                            0, buff, &len),
 | 
			
		||||
                              "smartcard transmit resend message "
 | 
			
		||||
                              +crypto::hex(in))) {
 | 
			
		||||
                      CRYPTOLOG("successful after retry nr. "<<cnt);
 | 
			
		||||
                      return std::string((char*)buff, len);
 | 
			
		||||
                    }
 | 
			
		||||
                  } catch (std::exception& x) {
 | 
			
		||||
                    CRYPTOLOG("failed with "<<x.what());
 | 
			
		||||
                    continue; // try again
 | 
			
		||||
                    CRYPTOLOG("failed again with "<<x.what());
 | 
			
		||||
                  }
 | 
			
		||||
                  break; // success
 | 
			
		||||
                }
 | 
			
		||||
#             endif
 | 
			
		||||
              CRYPTOLOG("definitely failed with "<<x.what());
 | 
			
		||||
              throw; // just rethrow otherwise
 | 
			
		||||
            }
 | 
			
		||||
            //CRYPTOLOG(" -> "<<crypto::hex(std::string((char*)buff, len)));
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user