projects
/
silc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
55401f4
)
Make packet stream reference counts 32 bits.
author
Skywing
<skywing@valhallalegends.com>
Fri, 20 Jun 2008 22:37:21 +0000
(17:37 -0500)
committer
Kp
<kp@valhallalegends.com>
Thu, 11 Sep 2008 03:27:33 +0000
(22:27 -0500)
lib/silccore/silcpacket.c
patch
|
blob
|
history
diff --git
a/lib/silccore/silcpacket.c
b/lib/silccore/silcpacket.c
index 614dc894650ce0e334051a508d1c052cef6e0d44..85d8b4e635dd73e24c585ff6f3d7f91e6bb48c85 100644
(file)
--- a/
lib/silccore/silcpacket.c
+++ b/
lib/silccore/silcpacket.c
@@
-81,7
+81,7
@@
struct SilcPacketStreamStruct {
unsigned char *dst_id; /* Destination ID */
SilcUInt32 send_psn; /* Sending sequence */
SilcUInt32 receive_psn; /* Receiving sequence */
unsigned char *dst_id; /* Destination ID */
SilcUInt32 send_psn; /* Sending sequence */
SilcUInt32 receive_psn; /* Receiving sequence */
- SilcAtomic
8 refcnt;
/* Reference counter */
+ SilcAtomic
32 refcnt;
/* Reference counter */
SilcUInt8 sid; /* Security ID, set if IV included */
unsigned int src_id_len : 6;
unsigned int src_id_type : 2;
SilcUInt8 sid; /* Security ID, set if IV included */
unsigned int src_id_len : 6;
unsigned int src_id_type : 2;
@@
-695,7
+695,7
@@
SilcPacketStream silc_packet_stream_create(SilcPacketEngine engine,
return NULL;
ps->stream = stream;
return NULL;
ps->stream = stream;
- silc_atomic_init
8
(&ps->refcnt, 1);
+ silc_atomic_init
32
(&ps->refcnt, 1);
silc_mutex_alloc(&ps->lock);
/* Allocate out buffer */
silc_mutex_alloc(&ps->lock);
/* Allocate out buffer */
@@
-816,7
+816,7
@@
SilcPacketStream silc_packet_stream_add_remote(SilcPacketStream stream,
return NULL;
ps->sc = stream->sc;
return NULL;
ps->sc = stream->sc;
- silc_atomic_init
8
(&ps->refcnt, 1);
+ silc_atomic_init
32
(&ps->refcnt, 1);
silc_mutex_alloc(&ps->lock);
/* Set the UDP packet stream as underlaying stream */
silc_mutex_alloc(&ps->lock);
/* Set the UDP packet stream as underlaying stream */
@@
-884,7
+884,7
@@
void silc_packet_stream_destroy(SilcPacketStream stream)
if (!stream)
return;
if (!stream)
return;
- if (silc_atomic_sub_int
8
(&stream->refcnt, 1) > 0) {
+ if (silc_atomic_sub_int
32
(&stream->refcnt, 1) > 0) {
if (stream->destroyed)
return;
stream->destroyed = TRUE;
if (stream->destroyed)
return;
stream->destroyed = TRUE;
@@
-972,7
+972,7
@@
void silc_packet_stream_destroy(SilcPacketStream stream)
silc_free(stream->src_id);
silc_free(stream->dst_id);
silc_free(stream->src_id);
silc_free(stream->dst_id);
- silc_atomic_uninit
8
(&stream->refcnt);
+ silc_atomic_uninit
32
(&stream->refcnt);
silc_mutex_free(stream->lock);
silc_free(stream);
}
silc_mutex_free(stream->lock);
silc_free(stream);
}
@@
-1154,10
+1154,10
@@
SilcBool silc_packet_get_sender(SilcPacket packet,
void silc_packet_stream_ref(SilcPacketStream stream)
{
void silc_packet_stream_ref(SilcPacketStream stream)
{
- silc_atomic_add_int
8
(&stream->refcnt, 1);
+ silc_atomic_add_int
32
(&stream->refcnt, 1);
SILC_LOG_DEBUG(("Stream %p, refcnt %d->%d", stream,
SILC_LOG_DEBUG(("Stream %p, refcnt %d->%d", stream,
- silc_atomic_get_int
8
(&stream->refcnt) - 1,
- silc_atomic_get_int
8
(&stream->refcnt)));
+ silc_atomic_get_int
32
(&stream->refcnt) - 1,
+ silc_atomic_get_int
32
(&stream->refcnt)));
}
/* Unreference packet stream */
}
/* Unreference packet stream */
@@
-1165,11
+1165,11
@@
void silc_packet_stream_ref(SilcPacketStream stream)
void silc_packet_stream_unref(SilcPacketStream stream)
{
SILC_LOG_DEBUG(("Stream %p, refcnt %d->%d", stream,
void silc_packet_stream_unref(SilcPacketStream stream)
{
SILC_LOG_DEBUG(("Stream %p, refcnt %d->%d", stream,
- silc_atomic_get_int
8
(&stream->refcnt),
- silc_atomic_get_int
8
(&stream->refcnt) - 1));
- if (silc_atomic_sub_int
8
(&stream->refcnt, 1) > 0)
+ silc_atomic_get_int
32
(&stream->refcnt),
+ silc_atomic_get_int
32
(&stream->refcnt) - 1));
+ if (silc_atomic_sub_int
32
(&stream->refcnt, 1) > 0)
return;
return;
- silc_atomic_add_int
8
(&stream->refcnt, 1);
+ silc_atomic_add_int
32
(&stream->refcnt, 1);
silc_packet_stream_destroy(stream);
}
silc_packet_stream_destroy(stream);
}