Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

userAgent.close closes all threads that were opened during the call #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ public void registering(SipRequest sipRequest) {

public synchronized void registerSuccess(SipResponse sipResponse) {
if (unregistering) {
userAgent.close();
applyNewConfig();
} else {
registration.registerSuccessful();
Expand All @@ -253,7 +252,6 @@ public synchronized void registerSuccess(SipResponse sipResponse) {

public void registerFailed(SipResponse sipResponse) {
if (unregistering) {
userAgent.close();
applyNewConfig();
} else {
registration.registerFailed();
Expand All @@ -280,7 +278,6 @@ public void run() {
runnable = new Runnable() {
@Override
public void run() {
userAgent.close();
applyNewConfig();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@

package net.sourceforge.peers.media;

import java.io.IOException;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;

import net.sourceforge.peers.Logger;
import net.sourceforge.peers.rtp.RtpPacket;
import net.sourceforge.peers.rtp.RtpSession;
import net.sourceforge.peers.sdp.Codec;
import net.sourceforge.peers.sip.core.useragent.UserAgent;

import java.io.IOException;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;

public class MediaManager {

public static final int DEFAULT_CLOCK = 8000; // Hz
Expand Down Expand Up @@ -309,7 +309,9 @@ public void stopSession() {
}
break;
case file:
fileReader.close();
if (fileReader != null) {
fileReader.close();
}
break;
default:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@

package net.sourceforge.peers.sip.core.useragent;

import java.io.File;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.List;

import net.sourceforge.peers.Config;
import net.sourceforge.peers.FileLogger;
import net.sourceforge.peers.Logger;
Expand All @@ -50,6 +45,11 @@
import net.sourceforge.peers.sip.transport.SipResponse;
import net.sourceforge.peers.sip.transport.TransportManager;

import java.io.File;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.List;


public class UserAgent {

Expand All @@ -74,6 +74,7 @@ public class UserAgent {
private DialogManager dialogManager;
private TransactionManager transactionManager;
private TransportManager transportManager;
private InviteHandler inviteHandler;

private int cseqCounter;
private SipListener sipListener;
Expand Down Expand Up @@ -143,7 +144,7 @@ private UserAgent(SipListener sipListener, Config config, String peersHome,

//core

InviteHandler inviteHandler = new InviteHandler(this,
inviteHandler = new InviteHandler(this,
dialogManager,
transactionManager,
transportManager,
Expand Down Expand Up @@ -232,6 +233,9 @@ private UserAgent(SipListener sipListener, Config config, String peersHome,

public void close() {
transportManager.closeTransports();
transactionManager.closeTimers();
inviteHandler.closeTimers();
mediaManager.stopSession();
config.setPublicInetAddress(null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ public void rejectCall(SipRequest sipRequest) {
//////////////////////////////////////////////////////////
// UAC methods
//////////////////////////////////////////////////////////

public void closeTimers() {
ackTimer.cancel();
}

public ClientTransaction preProcessInvite(SipRequest sipRequest)
throws SipUriSyntaxException {
Expand Down
Loading