Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • jkonra2m/tinydtls-cython
1 result
Show changes
Commits on Source (4)
...@@ -156,18 +156,20 @@ cdef class Connection(Session): ...@@ -156,18 +156,20 @@ cdef class Connection(Session):
def __init__(self, DTLS dtls, Session s): def __init__(self, DTLS dtls, Session s):
super().__init__(addr = s.addr, port = s.port, flowinfo=s.flowinfo, scope_id=s.scope_id) super().__init__(addr = s.addr, port = s.port, flowinfo=s.flowinfo, scope_id=s.scope_id)
self.d = dtls self.d = dtls
def __del__(self): def __dealloc__(self):
self.d.close(self) peer = tdtls.dtls_get_peer(self.d.ctx, &self.session)
self.d.resetPeer(self) if peer:
tdtls.dtls_reset_peer(self.d.ctx, peer)
cdef class MCConnection(Session): cdef class MCConnection(Session):
cdef DTLS d cdef DTLS d
def __init__(self, DTLS dtls, Session s): def __init__(self, DTLS dtls, Session s):
super().__init__(addr = s.addr, port = s.port, flowinfo=s.flowinfo, scope_id=s.scope_id) super().__init__(addr = s.addr, port = s.port, flowinfo=s.flowinfo, scope_id=s.scope_id)
self.d = dtls self.d = dtls
def __del__(self): def __dealloc__(self):
self.d.joinLeaveGroupe(self.addr, self.d._sock, join=False) peer = tdtls.dtls_get_peer(self.d.ctx, &self.session)
self.d.resetPeer(self) if peer:
tdtls.dtls_reset_peer(self.d.ctx, peer)
cdef class DTLS: cdef class DTLS:
cdef dtls_context_t *ctx cdef dtls_context_t *ctx
...@@ -242,7 +244,9 @@ cdef class DTLS: ...@@ -242,7 +244,9 @@ cdef class DTLS:
#dtls_peer_t *dtls_get_peer(const dtls_context_t *context, const session_t *session); #dtls_peer_t *dtls_get_peer(const dtls_context_t *context, const session_t *session);
#void dtls_reset_peer(dtls_context_t *ctx, dtls_peer_t *peer) #void dtls_reset_peer(dtls_context_t *ctx, dtls_peer_t *peer)
def resetPeer(self, Session session: Session): def resetPeer(self, Session session: Session):
tdtls.dtls_reset_peer(self.ctx, tdtls.dtls_get_peer(self.ctx, session.getSession())) peer = tdtls.dtls_get_peer(self.ctx, &session.session)
if peer:
tdtls.dtls_reset_peer(self.ctx, peer)
#int dtls_write(dtls_context_t *ctx, session_t *session, uint8 *buf, size_t len) #int dtls_write(dtls_context_t *ctx, session_t *session, uint8 *buf, size_t len)
def write(self, Session remote: Session, data: bytes): def write(self, Session remote: Session, data: bytes):
......
...@@ -32,7 +32,7 @@ with open("README.md", "r") as fh: ...@@ -32,7 +32,7 @@ with open("README.md", "r") as fh:
setup( setup(
name="DTLSSocket", name="DTLSSocket",
version='0.1.17', version='0.1.18',
description = "DTLSSocket is a cython wrapper for tinydtls with a Socket like interface", description = "DTLSSocket is a cython wrapper for tinydtls with a Socket like interface",
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
......