Tagify RedPhone classes.

// FREEBIE
pull/1/head
Moxie Marlinspike 9 years ago
parent 826dc601c1
commit 4fb5c6dd9a

@ -56,6 +56,8 @@ import org.thoughtcrime.securesms.recipients.Recipient;
*/
public class RedPhone extends Activity {
private static final String TAG = RedPhone.class.getSimpleName();
private static final int REMOTE_TERMINATE = 0;
private static final int LOCAL_TERMINATE = 1;
@ -129,7 +131,7 @@ public class RedPhone extends Activity {
}
private void initializeServiceBinding() {
Log.w("RedPhone", "Binding to RedPhoneService...");
Log.w(TAG, "Binding to RedPhoneService...");
Intent bindIntent = new Intent(this, RedPhoneService.class);
bindService(bindIntent, serviceConnection, Context.BIND_AUTO_CREATE);
}
@ -182,8 +184,8 @@ public class RedPhone extends Activity {
}
private void handleTerminate( int terminationType ) {
Log.w("RedPhone", "handleTerminate called");
Log.w("RedPhone", "Termination Stack:", new Exception());
Log.w(TAG, "handleTerminate called");
Log.w(TAG, "Termination Stack:", new Exception());
if( state == STATE_DIALING ) {
if (terminationType == LOCAL_TERMINATE) {
@ -321,7 +323,7 @@ public class RedPhone extends Activity {
private class CallStateHandler extends Handler {
@Override
public void handleMessage(Message message) {
Log.w("RedPhone", "Got message from service: " + message.what);
Log.w(TAG, "Got message from service: " + message.what);
switch (message.what) {
case HANDLE_CALL_CONNECTED: handleCallConnected((SASInfo)message.obj); break;
case HANDLE_SERVER_FAILURE: handleServerFailure(); break;
@ -345,7 +347,7 @@ public class RedPhone extends Activity {
private class HangupButtonListener implements CallControls.HangupButtonListener {
public void onClick() {
Log.w("RedPhone", "Hangup pressed, handling termination now...");
Log.w(TAG, "Hangup pressed, handling termination now...");
Intent intent = new Intent(RedPhone.this, RedPhoneService.class);
intent.setAction(RedPhoneService.ACTION_HANGUP_CALL);
startService(intent);
@ -438,7 +440,7 @@ public class RedPhone extends Activity {
// ApplicationContext.getInstance().getContext().getSystemService(Context.AUDIO_SERVICE);
int curVol = audioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL);
int maxVol = (int) (audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL) * 0.9);
Log.d("RedPhone", "volume up key press detected: " + curVol + " / " + maxVol);
Log.d(TAG, "volume up key press detected: " + curVol + " / " + maxVol);
if( curVol > maxVol ) {
audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL,maxVol,0);
}

@ -69,6 +69,8 @@ import java.util.List;
*/
public class RedPhoneService extends Service implements CallStateListener, CallStateView {
private static final String TAG = RedPhoneService.class.getSimpleName();
public static final String EXTRA_REMOTE_NUMBER = "remote_number";
public static final String EXTRA_SESSION_DESCRIPTOR = "session_descriptor";
public static final String EXTRA_MUTE = "mute_value";
@ -79,9 +81,6 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
public static final String ACTION_DENY_CALL = "org.thoughtcrime.redphone.RedPhoneService.DENYU_CALL";
public static final String ACTION_HANGUP_CALL = "org.thoughtcrime.redphone.RedPhoneService.HANGUP";
public static final String ACTION_SET_MUTE = "org.thoughtcrime.redphone.RedPhoneService.SET_MUTE";
public static final String ACTION_CONFIRM_SAS = "org.thoughtcrime.redphone.RedPhoneService.CONFIRM_SAS";
private static final String TAG = RedPhoneService.class.getName();
private final List<Message> bufferedEvents = new LinkedList<>();
private final IBinder binder = new RedPhoneServiceBinder();
@ -130,7 +129,7 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
}
private synchronized void onIntentReceived(Intent intent) {
Log.w("RedPhoneService", "Received Intent: " + intent.getAction());
Log.w(TAG, "Received Intent: " + intent.getAction());
if (intent.getAction().equals(ACTION_INCOMING_CALL) && isBusy()) handleBusyCall(intent);
else if (intent.getAction().equals(ACTION_INCOMING_CALL)) handleIncomingCall(intent);
@ -208,7 +207,7 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
SessionDescriptor session = intent.getParcelableExtra(EXTRA_SESSION_DESCRIPTOR);
if (currentCallManager != null && session.equals(currentCallManager.getSessionDescriptor())) {
Log.w("RedPhoneService", "Duplicate incoming call signal, ignoring...");
Log.w(TAG, "Duplicate incoming call signal, ignoring...");
return;
}
@ -223,7 +222,7 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
signalingSocket.setBusy(session.sessionId);
signalingSocket.close();
} catch (SignalingException e) {
Log.w("RedPhoneService", e);
Log.w(TAG, e);
}
}
@ -336,7 +335,7 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
}
private synchronized void terminate() {
Log.w("RedPhoneService", "termination stack", new Exception());
Log.w(TAG, "termination stack", new Exception());
lockManager.updatePhoneState(LockManager.PhoneState.PROCESSING);
NotificationBarManager.setCallEnded(this);
@ -369,13 +368,13 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
///////// CallStateListener Implementation
public void notifyCallStale() {
Log.w("RedPhoneService", "Got a stale call, probably an old SMS...");
Log.w(TAG, "Got a stale call, probably an old SMS...");
handleMissedCall(remoteNumber);
this.terminate();
}
public void notifyCallFresh() {
Log.w("RedPhoneService", "Good call, time to ring and display call card...");
Log.w(TAG, "Good call, time to ring and display call card...");
sendMessage(RedPhone.HANDLE_INCOMING_CALL, getRecipient());
lockManager.updatePhoneState(LockManager.PhoneState.INTERACTIVE);

@ -21,6 +21,7 @@ import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.util.Log;
import org.thoughtcrime.securesms.R;
@ -31,13 +32,14 @@ import java.io.IOException;
*
* @author Stuart O. Anderson
*/
public class OutgoingRinger implements MediaPlayer.OnCompletionListener,
MediaPlayer.OnPreparedListener {
public class OutgoingRinger implements MediaPlayer.OnCompletionListener, MediaPlayer.OnPreparedListener {
private static final String TAG = OutgoingRinger.class.getSimpleName();
private MediaPlayer mediaPlayer;
private int currentSoundID;
private boolean loopEnabled;
private Context context;
private int currentSoundID;
private boolean loopEnabled;
private Context context;
public OutgoingRinger(Context context) {
this.context = context;
@ -95,26 +97,26 @@ public class OutgoingRinger implements MediaPlayer.OnCompletionListener,
try {
mediaPlayer.setDataSource(context, dataUri);
} catch (IllegalArgumentException e) {
Log.w(TAG, e);
// TODO Auto-generated catch block
e.printStackTrace();
return;
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.w(TAG, e);
return;
} catch (IllegalStateException e) {
e.printStackTrace();
Log.w(TAG, e);
return;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.w(TAG, e);
return;
}
try {
mediaPlayer.prepareAsync();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.w(TAG, e);
return;
}
}

@ -49,9 +49,11 @@ import java.net.SocketException;
public abstract class CallManager extends Thread {
protected final String remoteNumber;
private static final String TAG = CallManager.class.getSimpleName();
protected final String remoteNumber;
protected final CallStateListener callStateListener;
protected final Context context;
protected final Context context;
private boolean terminated;
protected CallAudioManager callAudioManager;
@ -61,8 +63,8 @@ public abstract class CallManager extends Thread {
private boolean callConnected;
protected SessionDescriptor sessionDescriptor;
protected ZRTPSocket zrtpSocket;
protected SecureRtpSocket secureSocket;
protected ZRTPSocket zrtpSocket;
protected SecureRtpSocket secureSocket;
protected SignalingSocket signalingSocket;
public CallManager(Context context, CallStateListener callStateListener,
@ -82,7 +84,7 @@ public abstract class CallManager extends Thread {
Process.setThreadPriority(Process.THREAD_PRIORITY_URGENT_AUDIO);
try {
Log.d("CallManager", "negotiating...");
Log.d(TAG, "negotiating...");
if (!terminated) {
zrtpSocket.negotiateStart();
}
@ -98,23 +100,23 @@ public abstract class CallManager extends Thread {
}
if (!terminated) {
Log.d("CallManager", "Finished handshake, calling run() on CallAudioManager...");
Log.d(TAG, "Finished handshake, calling run() on CallAudioManager...");
callConnected = true;
runAudio(zrtpSocket.getDatagramSocket(), zrtpSocket.getRemoteIp(),
zrtpSocket.getRemotePort(), zrtpSocket.getMasterSecret(), muteEnabled);
}
} catch (RecipientUnavailableException rue) {
Log.w("CallManager", rue);
Log.w(TAG, rue);
if (!terminated) callStateListener.notifyRecipientUnavailable();
} catch (NegotiationFailedException nfe) {
Log.w("CallManager", nfe);
Log.w(TAG, nfe);
if (!terminated) callStateListener.notifyHandshakeFailed();
} catch (AudioException e) {
Log.w("CallManager", e);
Log.w(TAG, e);
callStateListener.notifyClientError(e.getClientMessage());
} catch (IOException e) {
Log.w("CallManager", e);
Log.w(TAG, e);
callStateListener.notifyCallDisconnected();
}
}
@ -141,7 +143,7 @@ public abstract class CallManager extends Thread {
}
protected void processSignals() {
Log.w("CallManager", "Starting signal processing loop...");
Log.w(TAG, "Starting signal processing loop...");
this.signalManager = new SignalManager(callStateListener, signalingSocket, sessionDescriptor);
}

@ -49,6 +49,8 @@ import java.net.SocketException;
*/
public class InitiatingCallManager extends CallManager {
private static final String TAG = InitiatingCallManager.class.getSimpleName();
private final String localNumber;
private final String password;
private final byte[] zid;
@ -91,23 +93,23 @@ public class InitiatingCallManager extends CallManager {
super.run();
} catch (NoSuchUserException nsue) {
Log.w("InitiatingCallManager", nsue);
Log.w(TAG, nsue);
callStateListener.notifyNoSuchUser();
} catch (ServerMessageException ife) {
Log.w("InitiatingCallManager", ife);
Log.w(TAG, ife);
callStateListener.notifyServerMessage(ife.getMessage());
} catch (LoginFailedException lfe) {
Log.w("InitiatingCallManager", lfe);
Log.w(TAG, lfe);
callStateListener.notifyLoginFailed();
} catch (SignalingException | SessionInitiationFailureException se) {
Log.w("InitiatingCallManager", se);
Log.w(TAG, se);
callStateListener.notifyServerFailure();
} catch (SocketException e) {
Log.w("InitiatingCallManager", e);
Log.w(TAG, e);
callStateListener.notifyCallDisconnected();
} catch( RuntimeException e ) {
Log.e("InitiatingCallManager", "Died with unhandled exception!");
Log.w("InitiatingCallManager", e);
Log.e(TAG, "Died with unhandled exception!");
Log.w(TAG, e);
callStateListener.notifyClientFailure();
}
}

@ -14,6 +14,9 @@ import android.util.Log;
* @author Stuart O. Anderson
*/
public class LockManager {
private static final String TAG = LockManager.class.getSimpleName();
private final PowerManager.WakeLock fullLock;
private final PowerManager.WakeLock partialLock;
private final KeyguardManager.KeyguardLock keyGuardLock;
@ -62,7 +65,7 @@ public class LockManager {
@Override
public void orientationChanged(int newOrientation) {
orientation = newOrientation;
Log.d("LockManager", "Orentation Update: " + newOrientation);
Log.d(TAG, "Orentation Update: " + newOrientation);
updateInCallLockState();
}
});
@ -72,7 +75,7 @@ public class LockManager {
private boolean isWifiPowerActiveModeEnabled(Context context) {
int wifi_pwr_active_mode = Settings.Secure.getInt(context.getContentResolver(), "wifi_pwr_active_mode", -1);
Log.d("LockManager", "Wifi Activity Policy: " + wifi_pwr_active_mode);
Log.d(TAG, "Wifi Activity Policy: " + wifi_pwr_active_mode);
if (wifi_pwr_active_mode == 0) {
return false;
@ -144,7 +147,7 @@ public class LockManager {
default:
throw new IllegalArgumentException("Unhandled Mode: " + newState);
}
Log.d("LockManager", "Entered Lock State: " + newState);
Log.d(TAG, "Entered Lock State: " + newState);
}
private void disableKeyguard() {

@ -17,6 +17,8 @@ import java.lang.reflect.Method;
*/
class ProximityLock {
private static final String TAG = ProximityLock.class.getSimpleName();
private final Method wakelockParameterizedRelease = getWakelockParamterizedReleaseMethod();
private final Optional<PowerManager.WakeLock> proximityLock;
@ -39,7 +41,7 @@ class ProximityLock {
try {
return Optional.fromNullable(pm.newWakeLock(PROXIMITY_SCREEN_OFF_WAKE_LOCK, "RedPhone Incall"));
} catch (Throwable t) {
Log.e("LockManager", "Failed to create proximity lock", t);
Log.e(TAG, "Failed to create proximity lock", t);
return Optional.absent();
}
}
@ -68,9 +70,9 @@ class ProximityLock {
wakelockParameterizedRelease.invoke(proximityLock.get(), WAIT_FOR_PROXIMITY_NEGATIVE);
released = true;
} catch (IllegalAccessException e) {
Log.w("ProximityLock", e);
Log.w(TAG, e);
} catch (InvocationTargetException e) {
Log.w("ProximityLock", e);
Log.w(TAG, e);
}
}
@ -79,14 +81,14 @@ class ProximityLock {
}
}
Log.d("LockManager", "Released proximity lock:" + proximityLock.get().isHeld());
Log.d(TAG, "Released proximity lock:" + proximityLock.get().isHeld());
}
private static Method getWakelockParamterizedReleaseMethod() {
try {
return PowerManager.WakeLock.class.getDeclaredMethod("release", Integer.TYPE);
} catch (NoSuchMethodException e) {
Log.d("LockManager", "Parameterized WakeLock release not available on this device.");
Log.d(TAG, "Parameterized WakeLock release not available on this device.");
}
return null;
}

@ -47,6 +47,8 @@ import java.net.SocketException;
*/
public class ResponderCallManager extends CallManager {
private static final String TAG = ResponderCallManager.class.getSimpleName();
private final String localNumber;
private final String password;
private final byte[] zid;
@ -96,24 +98,21 @@ public class ResponderCallManager extends CallManager {
callStateListener.notifyConnectingtoInitiator();
super.run();
} catch (SignalingException se) {
Log.w("ResponderCallManager", se);
callStateListener.notifyServerFailure();
} catch (SessionInitiationFailureException e) {
Log.w("ResponderCallManager", e);
} catch (SignalingException | SessionInitiationFailureException se) {
Log.w(TAG, se);
callStateListener.notifyServerFailure();
} catch (SessionStaleException e) {
Log.w("ResponderCallManager", e);
Log.w(TAG, e);
callStateListener.notifyCallStale();
} catch (LoginFailedException lfe) {
Log.w("ResponderCallManager", lfe);
Log.w(TAG, lfe);
callStateListener.notifyLoginFailed();
} catch (SocketException e) {
Log.w("ResponderCallManager", e);
Log.w(TAG, e);
callStateListener.notifyCallDisconnected();
} catch( RuntimeException e ) {
Log.e("ResponderCallManager", "Died unhandled with exception!");
Log.w("ResponderCallManager", e);
Log.e(TAG, "Died unhandled with exception!");
Log.w(TAG, e);
callStateListener.notifyClientFailure();
}
}

@ -12,6 +12,8 @@ import java.util.concurrent.Executors;
public class SignalManager {
private static final String TAG = SignalManager.class.getSimpleName();
private final ExecutorService queue = Executors.newSingleThreadExecutor();
private final SignalingSocket signalingSocket;
@ -32,10 +34,10 @@ public class SignalManager {
}
public void terminate() {
Log.w("SignalManager", "Queuing hangup signal...");
Log.w(TAG, "Queuing hangup signal...");
queue.execute(new Runnable() {
public void run() {
Log.w("SignalManager", "Sending hangup signal...");
Log.w(TAG, "Sending hangup signal...");
signalingSocket.setHangup(sessionDescriptor.sessionId);
signalingSocket.close();
queue.shutdownNow();
@ -47,7 +49,7 @@ public class SignalManager {
private class SignalListenerTask implements Runnable {
public void run() {
Log.w("SignalManager", "Running Signal Listener...");
Log.w(TAG, "Running Signal Listener...");
try {
while (!interrupted) {
@ -55,7 +57,7 @@ public class SignalManager {
break;
}
Log.w("SignalManager", "Signal Listener Running, interrupted: " + interrupted);
Log.w(TAG, "Signal Listener Running, interrupted: " + interrupted);
if (!interrupted) {
ServerSignal signal = signalingSocket.readSignal();
@ -64,7 +66,7 @@ public class SignalManager {
if (signal.isHangup(sessionId)) callStateListener.notifyCallDisconnected();
else if (signal.isRinging(sessionId)) callStateListener.notifyCallRinging();
else if (signal.isBusy(sessionId)) callStateListener.notifyBusy();
else if (signal.isKeepAlive()) Log.w("CallManager", "Received keep-alive...");
else if (signal.isKeepAlive()) Log.w(TAG, "Received keep-alive...");
signalingSocket.sendOkResponse();
}
@ -72,7 +74,7 @@ public class SignalManager {
interrupted = false;
queue.execute(this);
} catch (SignalingException e) {
Log.w("CallManager", e);
Log.w(TAG, e);
callStateListener.notifyCallDisconnected();
}
}

@ -59,31 +59,13 @@ public class EncryptedSignalMessage {
private final String message;
private final byte[] key;
// private final Context context;
public EncryptedSignalMessage(String message, String key) throws IOException {
this.message = message;
this.key = Base64.decode(key);
// this.context = context.getApplicationContext();
}
// private byte[] getCombinedKey() throws InvalidEncryptedSignalException, IOException {
//// SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
//// String key = preferences.getString(Constants.KEY_PREFERENCE, null);
//
// if (key == null)
// throw new InvalidEncryptedSignalException("No combined key available!");
//
// byte[] keyBytes = Base64.decode(key);
//
// if (keyBytes.length != 40)
// throw new InvalidEncryptedSignalException("Local cipher+mac key != 40 bytes?");
//
// return keyBytes;
// }
private byte[] getCipherKey() throws InvalidEncryptedSignalException, IOException {
// byte[] keyBytes = getCombinedKey();
byte[] cipherKeyBytes = new byte[16];
System.arraycopy(key, 0, cipherKeyBytes, 0, cipherKeyBytes.length);
@ -91,7 +73,6 @@ public class EncryptedSignalMessage {
}
private byte[] getMacKey() throws InvalidEncryptedSignalException, IOException {
// byte[] keyBytes = getCombinedKey();
byte[] macKeyBytes = new byte[20];
System.arraycopy(key, 16, macKeyBytes, 0, macKeyBytes.length);

@ -40,10 +40,8 @@ public class Otp {
mac.init(key);
return Base64.encodeBytes(mac.doFinal((counter+"").getBytes()));
} catch (NoSuchAlgorithmException nsae) {
} catch (NoSuchAlgorithmException | InvalidKeyException nsae) {
throw new AssertionError(nsae);
} catch (InvalidKeyException e) {
throw new AssertionError(e);
}
}
}

@ -40,6 +40,8 @@ import java.net.DatagramSocket;
public class SecureRtpSocket {
private static final String TAG = SecureRtpPacket.class.getSimpleName();
private final RtpSocket socket;
public SecureRtpSocket(RtpSocket socket) {
@ -78,7 +80,7 @@ public class SecureRtpSocket {
if (!verifyCRC || handshakePacket.verifyCRC()) {
return handshakePacket;
} else {
Log.w("SecureRedPhoneSocket", "Bad CRC!");
Log.w(TAG, "Bad CRC!");
return null;
}
}

@ -39,6 +39,8 @@ import java.util.Iterator;
*/
public class LowLatencySocketConnector {
private static final String TAG = LowLatencySocketConnector.class.getSimpleName();
private static final int CONNECT_TIMEOUT_MILLIS = 10000;
public static Socket connect(InetAddress[] addresses, int port) throws IOException {
@ -105,7 +107,7 @@ public class LowLatencySocketConnector {
try {
return channel.finishConnect();
} catch (IOException ioe) {
Log.w("LowLatencySocketConnector", ioe);
Log.w(TAG, ioe);
return false;
}
}

@ -33,6 +33,8 @@ import java.net.SocketTimeoutException;
*/
public class RtpSocket {
private static final String TAG = RtpSocket.class.getSimpleName();
private final byte [] buf = new byte[4096];
private final String remoteIp;
@ -46,7 +48,7 @@ public class RtpSocket {
this.remotePort = remoteAddress.getPort();
socket.connect(new InetSocketAddress(remoteIp, remotePort));
Log.d("RtpSocket", "Connected to: " + remoteIp);
Log.d(TAG, "Connected to: " + remoteIp);
}
public String getRemoteIp() {
@ -65,7 +67,7 @@ public class RtpSocket {
try {
socket.setSoTimeout(timeoutMillis);
} catch (SocketException e) {
Log.w("RtpSocket", e);
Log.w(TAG, e);
}
}

@ -42,13 +42,16 @@ import java.util.Map;
*/
public class NetworkConnector {
private DatagramSocket socket;
private final long sessionId;
private final String server;
private final int port;
private static final String TAG = NetworkConnector.class.getSimpleName();
private DatagramSocket socket;
private final long sessionId;
private final String server;
private final int port;
public NetworkConnector(long sessionId, String server, int port) {
Log.w("NetworkConnector", "Opening up port: " + server + " , " + port);
Log.w(TAG, "Opening up port: " + server + " , " + port);
this.sessionId = sessionId;
this.server = server;
this.port = port;
@ -58,7 +61,7 @@ public class NetworkConnector {
int result = -1;
int timeout = 1000;
for (int attempts = 0; attempts < 5; attempts++) {
Log.d("NetworkConnector", "attempting connection");
Log.d(TAG, "attempting connection");
result = attemptConnection( timeout );
if (result != -1)
break;
@ -82,7 +85,7 @@ public class NetworkConnector {
SignalResponse response = readSignalResponse();
if (response.getStatusCode() != 200) {
Log.e("NetworkConnector", "Bad response from server.");
Log.e(TAG, "Bad response from server.");
socket.close();
return -1;
}
@ -92,7 +95,7 @@ public class NetworkConnector {
return localPort;
} catch (IOException | SignalingException e) {
Log.w("NetworkConnector", e);
Log.w(TAG, e);
}
return -1;
}

@ -31,10 +31,11 @@ import org.thoughtcrime.securesms.BuildConfig;
*/
public class SessionDescriptor implements Parcelable {
public int relayPort;
public long sessionId;
public int relayPort;
public long sessionId;
public String serverName;
public int version;
public int version;
public SessionDescriptor() {}

@ -68,17 +68,18 @@ import javax.net.ssl.TrustManagerFactory;
*/
public class SignalingSocket {
private static final String TAG = SignalingSocket.class.getSimpleName();
protected static final int PROTOCOL_VERSION = 1;
private final Context context;
private final Socket socket;
private final String signalingHost;
private final int signalingPort;
protected final LineReader lineReader;
protected final OutputStream outputStream;
protected final String localNumber;
protected final String password;
protected final LineReader lineReader;
protected final OutputStream outputStream;
protected final String localNumber;
protected final String password;
protected final OtpCounterProvider counterProvider;
private boolean connectionAttemptComplete;
@ -91,9 +92,7 @@ public class SignalingSocket {
try {
this.context = context.getApplicationContext();
this.connectionAttemptComplete = false;
this.signalingHost = host;
this.signalingPort = port;
this.socket = constructSSLSocket(context, signalingHost, signalingPort);
this.socket = constructSSLSocket(context, host, port);
this.outputStream = this.socket.getOutputStream();
this.lineReader = new LineReader(socket.getInputStream());
this.localNumber = localNumber;
@ -126,7 +125,7 @@ public class SignalingSocket {
InetAddress[] addresses = InetAddress.getAllByName(host);
Socket stagedSocket = LowLatencySocketConnector.connect(addresses, port);
Log.w("SignalingSocket", "Connected to: " + stagedSocket.getInetAddress().getHostAddress());
Log.w(TAG, "Connected to: " + stagedSocket.getInetAddress().getHostAddress());
SocketConnectMonitor monitor = new SocketConnectMonitor(stagedSocket);
@ -263,7 +262,7 @@ public class SignalingSocket {
protected void sendSignal(Signal signal) throws SignalingException {
try {
Log.d("SignalingSocket", "Sending signal...");
Log.d(TAG, "Sending signal...");
this.outputStream.write(signal.serialize().getBytes());
} catch (IOException ioe) {
throw new SignalingException(ioe);
@ -297,7 +296,7 @@ public class SignalingSocket {
if (!SignalingSocket.this.connectionAttemptComplete) SignalingSocket.this.wait(10000);
if (!SignalingSocket.this.connectionAttemptComplete) this.socket.close();
} catch (IOException ioe) {
Log.w("SignalingSocket", ioe);
Log.w(TAG, ioe);
} catch (InterruptedException e) {
throw new AssertionError(e);
}

Loading…
Cancel
Save