.class public final Lz5/us1;
.super Lz5/a3;
.source ""


# instance fields
.field public A:Ljava/net/InetAddress;

.field public B:Ljava/net/InetSocketAddress;

.field public C:Z

.field public D:I

.field public final v:[B

.field public final w:Ljava/net/DatagramPacket;

.field public x:Landroid/net/Uri;

.field public y:Ljava/net/DatagramSocket;

.field public z:Ljava/net/MulticastSocket;


# direct methods
.method public constructor <init>(I)V
    .registers 5

    const/4 p1, 0x1

    invoke-direct {p0, p1}, Lz5/a3;-><init>(Z)V

    const/16 p1, 0x7d0

    new-array v0, p1, [B

    iput-object v0, p0, Lz5/us1;->v:[B

    new-instance v1, Ljava/net/DatagramPacket;

    const/4 v2, 0x0

    invoke-direct {v1, v0, v2, p1}, Ljava/net/DatagramPacket;-><init>([BII)V

    iput-object v1, p0, Lz5/us1;->w:Ljava/net/DatagramPacket;

    return-void
.end method


# virtual methods
.method public final a([BII)I
    .registers 7

    if-nez p3, :cond_4

    const/4 p1, 0x0

    return p1

    :cond_4
    iget v0, p0, Lz5/us1;->D:I

    if-nez v0, :cond_2d

    :try_start_8
    iget-object v0, p0, Lz5/us1;->y:Ljava/net/DatagramSocket;

    iget-object v1, p0, Lz5/us1;->w:Ljava/net/DatagramPacket;

    invoke-virtual {v0, v1}, Ljava/net/DatagramSocket;->receive(Ljava/net/DatagramPacket;)V
    :try_end_f
    .catch Ljava/net/SocketTimeoutException; {:try_start_8 .. :try_end_f} :catch_24
    .catch Ljava/io/IOException; {:try_start_8 .. :try_end_f} :catch_1b

    iget-object v0, p0, Lz5/us1;->w:Ljava/net/DatagramPacket;

    invoke-virtual {v0}, Ljava/net/DatagramPacket;->getLength()I

    move-result v0

    iput v0, p0, Lz5/us1;->D:I

    invoke-virtual {p0, v0}, Lz5/a3;->m(I)V

    goto :goto_2d

    :catch_1b
    move-exception p1

    new-instance p2, Lz5/ts1;

    const/16 p3, 0x7d1

    invoke-direct {p2, p1, p3}, Lz5/ts1;-><init>(Ljava/lang/Throwable;I)V

    throw p2

    :catch_24
    move-exception p1

    new-instance p2, Lz5/ts1;

    const/16 p3, 0x7d2

    invoke-direct {p2, p1, p3}, Lz5/ts1;-><init>(Ljava/lang/Throwable;I)V

    throw p2

    :cond_2d
    :goto_2d
    iget-object v0, p0, Lz5/us1;->w:Ljava/net/DatagramPacket;

    invoke-virtual {v0}, Ljava/net/DatagramPacket;->getLength()I

    move-result v0

    iget v1, p0, Lz5/us1;->D:I

    invoke-static {v1, p3}, Ljava/lang/Math;->min(II)I

    move-result p3

    iget-object v2, p0, Lz5/us1;->v:[B

    sub-int/2addr v0, v1

    invoke-static {v2, v0, p1, p2, p3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    iget p1, p0, Lz5/us1;->D:I

    sub-int/2addr p1, p3

    iput p1, p0, Lz5/us1;->D:I

    return p3
.end method

.method public final h(Lz5/a8;)J
    .registers 5

    iget-object v0, p1, Lz5/a8;->a:Landroid/net/Uri;

    iput-object v0, p0, Lz5/us1;->x:Landroid/net/Uri;

    invoke-virtual {v0}, Landroid/net/Uri;->getHost()Ljava/lang/String;

    move-result-object v0

    iget-object v1, p0, Lz5/us1;->x:Landroid/net/Uri;

    invoke-virtual {v1}, Landroid/net/Uri;->getPort()I

    move-result v1

    invoke-virtual {p0, p1}, Lz5/a3;->c(Lz5/a8;)V

    :try_start_11
    invoke-static {v0}, Ljava/net/InetAddress;->getByName(Ljava/lang/String;)Ljava/net/InetAddress;

    move-result-object v0

    iput-object v0, p0, Lz5/us1;->A:Ljava/net/InetAddress;

    new-instance v0, Ljava/net/InetSocketAddress;

    iget-object v2, p0, Lz5/us1;->A:Ljava/net/InetAddress;

    invoke-direct {v0, v2, v1}, Ljava/net/InetSocketAddress;-><init>(Ljava/net/InetAddress;I)V

    iput-object v0, p0, Lz5/us1;->B:Ljava/net/InetSocketAddress;

    iget-object v0, p0, Lz5/us1;->A:Ljava/net/InetAddress;

    invoke-virtual {v0}, Ljava/net/InetAddress;->isMulticastAddress()Z

    move-result v0

    if-eqz v0, :cond_3b

    new-instance v0, Ljava/net/MulticastSocket;

    iget-object v1, p0, Lz5/us1;->B:Ljava/net/InetSocketAddress;

    invoke-direct {v0, v1}, Ljava/net/MulticastSocket;-><init>(Ljava/net/SocketAddress;)V

    iput-object v0, p0, Lz5/us1;->z:Ljava/net/MulticastSocket;

    iget-object v1, p0, Lz5/us1;->A:Ljava/net/InetAddress;

    invoke-virtual {v0, v1}, Ljava/net/MulticastSocket;->joinGroup(Ljava/net/InetAddress;)V

    iget-object v0, p0, Lz5/us1;->z:Ljava/net/MulticastSocket;

    :goto_38
    iput-object v0, p0, Lz5/us1;->y:Ljava/net/DatagramSocket;

    goto :goto_43

    :cond_3b
    new-instance v0, Ljava/net/DatagramSocket;

    iget-object v1, p0, Lz5/us1;->B:Ljava/net/InetSocketAddress;

    invoke-direct {v0, v1}, Ljava/net/DatagramSocket;-><init>(Ljava/net/SocketAddress;)V

    goto :goto_38

    :goto_43
    iget-object v0, p0, Lz5/us1;->y:Ljava/net/DatagramSocket;

    const/16 v1, 0x1f40

    invoke-virtual {v0, v1}, Ljava/net/DatagramSocket;->setSoTimeout(I)V
    :try_end_4a
    .catch Ljava/lang/SecurityException; {:try_start_11 .. :try_end_4a} :catch_5c
    .catch Ljava/io/IOException; {:try_start_11 .. :try_end_4a} :catch_53

    const/4 v0, 0x1

    iput-boolean v0, p0, Lz5/us1;->C:Z

    invoke-virtual {p0, p1}, Lz5/a3;->i(Lz5/a8;)V

    const-wide/16 v0, -0x1

    return-wide v0

    :catch_53
    move-exception p1

    new-instance v0, Lz5/ts1;

    const/16 v1, 0x7d1

    invoke-direct {v0, p1, v1}, Lz5/ts1;-><init>(Ljava/lang/Throwable;I)V

    throw v0

    :catch_5c
    move-exception p1

    new-instance v0, Lz5/ts1;

    const/16 v1, 0x7d6

    invoke-direct {v0, p1, v1}, Lz5/ts1;-><init>(Ljava/lang/Throwable;I)V

    throw v0
.end method

.method public final zzi()Landroid/net/Uri;
    .registers 2

    iget-object v0, p0, Lz5/us1;->x:Landroid/net/Uri;

    return-object v0
.end method

.method public final zzj()V
    .registers 4

    const/4 v0, 0x0

    iput-object v0, p0, Lz5/us1;->x:Landroid/net/Uri;

    iget-object v1, p0, Lz5/us1;->z:Ljava/net/MulticastSocket;

    if-eqz v1, :cond_e

    :try_start_7
    iget-object v2, p0, Lz5/us1;->A:Ljava/net/InetAddress;

    invoke-virtual {v1, v2}, Ljava/net/MulticastSocket;->leaveGroup(Ljava/net/InetAddress;)V
    :try_end_c
    .catch Ljava/io/IOException; {:try_start_7 .. :try_end_c} :catch_c

    :catch_c
    iput-object v0, p0, Lz5/us1;->z:Ljava/net/MulticastSocket;

    :cond_e
    iget-object v1, p0, Lz5/us1;->y:Ljava/net/DatagramSocket;

    if-eqz v1, :cond_17

    invoke-virtual {v1}, Ljava/net/DatagramSocket;->close()V

    iput-object v0, p0, Lz5/us1;->y:Ljava/net/DatagramSocket;

    :cond_17
    iput-object v0, p0, Lz5/us1;->A:Ljava/net/InetAddress;

    iput-object v0, p0, Lz5/us1;->B:Ljava/net/InetSocketAddress;

    const/4 v0, 0x0

    iput v0, p0, Lz5/us1;->D:I

    iget-boolean v1, p0, Lz5/us1;->C:Z

    if-eqz v1, :cond_27

    iput-boolean v0, p0, Lz5/us1;->C:Z

    invoke-virtual {p0}, Lz5/a3;->n()V

    :cond_27
    return-void
.end method
